Compare commits
No commits in common. "c9s" and "c8s" have entirely different histories.
@ -1 +0,0 @@
|
|||||||
1
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
/findutils-4.*.*.tar.?z
|
/findutils-4.*.*.tar.gz
|
||||||
|
@ -8,15 +8,15 @@ Subject: [PATCH] findutils-4.4.2-xautofs.patch
|
|||||||
find/defs.h | 3 +++
|
find/defs.h | 3 +++
|
||||||
find/find.1 | 3 +++
|
find/find.1 | 3 +++
|
||||||
find/ftsfind.c | 11 +++++++++--
|
find/ftsfind.c | 11 +++++++++--
|
||||||
find/parser.c | 9 +++++++++
|
find/parser.c | 11 ++++++++++-
|
||||||
find/util.c | 3 ++-
|
find/util.c | 1 +
|
||||||
6 files changed, 30 insertions(+), 3 deletions(-)
|
6 files changed, 30 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/doc/find.texi b/doc/find.texi
|
diff --git a/doc/find.texi b/doc/find.texi
|
||||||
index f31f8d1..b2e5fc5 100644
|
index b32db8c..1691d2d 100644
|
||||||
--- a/doc/find.texi
|
--- a/doc/find.texi
|
||||||
+++ b/doc/find.texi
|
+++ b/doc/find.texi
|
||||||
@@ -1517,6 +1517,10 @@ them.
|
@@ -1446,6 +1446,10 @@ them.
|
||||||
There are two ways to avoid searching certain filesystems. One way is
|
There are two ways to avoid searching certain filesystems. One way is
|
||||||
to tell @code{find} to only search one filesystem:
|
to tell @code{find} to only search one filesystem:
|
||||||
|
|
||||||
@ -28,10 +28,10 @@ index f31f8d1..b2e5fc5 100644
|
|||||||
@deffnx Option -mount
|
@deffnx Option -mount
|
||||||
Don't descend directories on other filesystems. These options are
|
Don't descend directories on other filesystems. These options are
|
||||||
diff --git a/find/defs.h b/find/defs.h
|
diff --git a/find/defs.h b/find/defs.h
|
||||||
index 72048ff..adb5973 100644
|
index ba0b855..7e6d4bb 100644
|
||||||
--- a/find/defs.h
|
--- a/find/defs.h
|
||||||
+++ b/find/defs.h
|
+++ b/find/defs.h
|
||||||
@@ -574,6 +574,9 @@ struct options
|
@@ -557,6 +557,9 @@ struct options
|
||||||
/* If true, don't cross filesystem boundaries. */
|
/* If true, don't cross filesystem boundaries. */
|
||||||
bool stay_on_filesystem;
|
bool stay_on_filesystem;
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ index 72048ff..adb5973 100644
|
|||||||
* no longer exists by the time we get around to processing it.
|
* no longer exists by the time we get around to processing it.
|
||||||
*/
|
*/
|
||||||
diff --git a/find/find.1 b/find/find.1
|
diff --git a/find/find.1 b/find/find.1
|
||||||
index a536106..b8cf1fb 100644
|
index 7b141b8..a36a0bc 100644
|
||||||
--- a/find/find.1
|
--- a/find/find.1
|
||||||
+++ b/find/find.1
|
+++ b/find/find.1
|
||||||
@@ -576,6 +576,9 @@ to stat them; this gives a significant increase in search speed.
|
@@ -520,6 +520,9 @@ to stat them; this gives a significant increase in search speed.
|
||||||
.IP "\-version, \-\-version"
|
.IP "\-version, \-\-version"
|
||||||
Print the \fBfind\fR version number and exit.
|
Print the \fBfind\fR version number and exit.
|
||||||
|
|
||||||
@ -56,10 +56,10 @@ index a536106..b8cf1fb 100644
|
|||||||
Don't descend directories on other filesystems.
|
Don't descend directories on other filesystems.
|
||||||
|
|
||||||
diff --git a/find/ftsfind.c b/find/ftsfind.c
|
diff --git a/find/ftsfind.c b/find/ftsfind.c
|
||||||
index 109f23a..5c4c2e2 100644
|
index 414327b..6620bdb 100644
|
||||||
--- a/find/ftsfind.c
|
--- a/find/ftsfind.c
|
||||||
+++ b/find/ftsfind.c
|
+++ b/find/ftsfind.c
|
||||||
@@ -267,8 +267,8 @@ symlink_loop (const char *name)
|
@@ -331,8 +331,8 @@ show_outstanding_execdirs (FILE *fp)
|
||||||
static void
|
static void
|
||||||
consider_visiting (FTS *p, FTSENT *ent)
|
consider_visiting (FTS *p, FTSENT *ent)
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ index 109f23a..5c4c2e2 100644
|
|||||||
int ignore, isdir;
|
int ignore, isdir;
|
||||||
|
|
||||||
if (options.debug_options & DebugSearch)
|
if (options.debug_options & DebugSearch)
|
||||||
@@ -432,6 +432,13 @@ consider_visiting (FTS *p, FTSENT *ent)
|
@@ -485,6 +485,13 @@ consider_visiting (FTS *p, FTSENT *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,26 +85,35 @@ index 109f23a..5c4c2e2 100644
|
|||||||
{
|
{
|
||||||
/* this is the preorder visit, but user said -depth */
|
/* this is the preorder visit, but user said -depth */
|
||||||
diff --git a/find/parser.c b/find/parser.c
|
diff --git a/find/parser.c b/find/parser.c
|
||||||
index 8546982..3d42efc 100644
|
index b57cdda..91e914a 100644
|
||||||
--- a/find/parser.c
|
--- a/find/parser.c
|
||||||
+++ b/find/parser.c
|
+++ b/find/parser.c
|
||||||
@@ -138,6 +138,7 @@ static bool parse_used (const struct parser_table*, char *argv[], int *
|
@@ -146,6 +146,7 @@ static bool parse_user (const struct parser_table*, char *argv[], int *
|
||||||
static bool parse_user (const struct parser_table*, char *argv[], int *arg_ptr);
|
static bool parse_version (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||||
static bool parse_wholename (const struct parser_table*, char *argv[], int *arg_ptr);
|
static bool parse_wholename (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||||
static bool parse_xdev (const struct parser_table*, char *argv[], int *arg_ptr);
|
static bool parse_xdev (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||||
+static bool parse_xautofs (const struct parser_table*, char *argv[], int *arg_ptr);
|
+static bool parse_xautofs (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||||
static bool parse_ignore_race (const struct parser_table*, char *argv[], int *arg_ptr);
|
static bool parse_ignore_race (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||||
static bool parse_noignore_race (const struct parser_table*, char *argv[], int *arg_ptr);
|
static bool parse_noignore_race (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||||
static bool parse_warn (const struct parser_table*, char *argv[], int *arg_ptr);
|
static bool parse_warn (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||||
@@ -302,6 +303,7 @@ static struct parser_table const parse_table[] =
|
@@ -306,6 +307,7 @@ static struct parser_table const parse_table[] =
|
||||||
PARSE_TEST_NP ("wholename", wholename), /* GNU, replaced -path, but now -path is standardized since POSIX 2008 */
|
PARSE_TEST_NP ("wholename", wholename), /* GNU, replaced -path, but anyway -path will soon be in POSIX */
|
||||||
{ARG_TEST, "writable", parse_accesscheck, pred_writable}, /* GNU, 4.3.0+ */
|
{ARG_TEST, "writable", parse_accesscheck, pred_writable}, /* GNU, 4.3.0+ */
|
||||||
PARSE_OPTION ("xdev", xdev), /* POSIX */
|
PARSE_OPTION ("xdev", xdev), /* POSIX */
|
||||||
+ PARSE_OPTION ("xautofs", xautofs),
|
+ PARSE_OPTION ("xautofs", xautofs),
|
||||||
PARSE_TEST ("xtype", xtype), /* GNU */
|
PARSE_TEST ("xtype", xtype), /* GNU */
|
||||||
#ifdef UNIMPLEMENTED_UNIX
|
#ifdef UNIMPLEMENTED_UNIX
|
||||||
/* It's pretty ugly for find to know about archive formats.
|
/* It's pretty ugly for find to know about archive formats.
|
||||||
@@ -2594,6 +2596,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
|
@@ -1239,7 +1241,7 @@ operators (decreasing precedence; -and is implicit where no others are given):\n
|
||||||
|
positional options (always true): -daystart -follow -regextype\n\n\
|
||||||
|
normal options (always true, specified before other expressions):\n\
|
||||||
|
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf\n\
|
||||||
|
- --version -xdev -ignore_readdir_race -noignore_readdir_race\n"));
|
||||||
|
+ --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race\n"));
|
||||||
|
puts (_("\
|
||||||
|
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\
|
||||||
|
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME\n\
|
||||||
|
@@ -2682,6 +2684,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
|
||||||
return parse_noop (entry, argv, arg_ptr);
|
return parse_noop (entry, argv, arg_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,19 +128,10 @@ index 8546982..3d42efc 100644
|
|||||||
parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr)
|
parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr)
|
||||||
{
|
{
|
||||||
diff --git a/find/util.c b/find/util.c
|
diff --git a/find/util.c b/find/util.c
|
||||||
index 959272a..e7d174e 100644
|
index 5ffe140..3448a67 100644
|
||||||
--- a/find/util.c
|
--- a/find/util.c
|
||||||
+++ b/find/util.c
|
+++ b/find/util.c
|
||||||
@@ -181,7 +181,7 @@ operators (decreasing precedence; -and is implicit where no others are given):\n
|
@@ -1017,6 +1017,7 @@ set_option_defaults (struct options *p)
|
||||||
positional options (always true): -daystart -follow -regextype\n\n\
|
|
||||||
normal options (always true, specified before other expressions):\n\
|
|
||||||
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf\n\
|
|
||||||
- --version -xdev -ignore_readdir_race -noignore_readdir_race\n"));
|
|
||||||
+ --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race\n"));
|
|
||||||
HTL (_("\
|
|
||||||
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\
|
|
||||||
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME\n\
|
|
||||||
@@ -1044,6 +1044,7 @@ set_option_defaults (struct options *p)
|
|
||||||
|
|
||||||
p->full_days = false;
|
p->full_days = false;
|
||||||
p->stay_on_filesystem = false;
|
p->stay_on_filesystem = false;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 690d4bd9f29a805999a3ce4651dac9585ccc9917 Mon Sep 17 00:00:00 2001
|
From 690d4bd9f29a805999a3ce4651dac9585ccc9917 Mon Sep 17 00:00:00 2001
|
||||||
From: Kamil Dudka <kdudka@redhat.com>
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
Date: Wed, 11 May 2011 16:46:57 +0200
|
Date: Wed, 11 May 2011 16:46:57 +0200
|
||||||
Subject: [PATCH] findutils-4.5.7-warnings.patch
|
Subject: [PATCH 1/2] findutils-4.5.7-warnings.patch
|
||||||
|
|
||||||
---
|
---
|
||||||
xargs/xargs.c | 3 ++-
|
xargs/xargs.c | 3 ++-
|
||||||
@ -11,7 +11,7 @@ diff --git a/xargs/xargs.c b/xargs/xargs.c
|
|||||||
index 5e373f2..c0a8676 100644
|
index 5e373f2..c0a8676 100644
|
||||||
--- a/xargs/xargs.c
|
--- a/xargs/xargs.c
|
||||||
+++ b/xargs/xargs.c
|
+++ b/xargs/xargs.c
|
||||||
@@ -1299,7 +1299,8 @@ xargs_do_exec (struct buildcmd_control *ctl, void *usercontext, int argc, char *
|
@@ -1289,7 +1289,8 @@ xargs_do_exec (struct buildcmd_control *ctl, void *usercontext, int argc, char *
|
||||||
* utility if we run it, for POSIX compliance on the
|
* utility if we run it, for POSIX compliance on the
|
||||||
* handling of exit values.
|
* handling of exit values.
|
||||||
*/
|
*/
|
||||||
@ -24,3 +24,30 @@ index 5e373f2..c0a8676 100644
|
|||||||
--
|
--
|
||||||
1.7.1
|
1.7.1
|
||||||
|
|
||||||
|
|
||||||
|
From c5654b9ca5f50daa1ca406ebd7b4546f24d00db6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
Date: Mon, 23 Sep 2013 15:04:03 +0200
|
||||||
|
Subject: [PATCH 2/2] parser: silence a [-Wmaybe-uninitialized] GCC warning
|
||||||
|
|
||||||
|
... caused by a missing model of error()
|
||||||
|
---
|
||||||
|
find/parser.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/find/parser.c b/find/parser.c
|
||||||
|
index 89d8bcf..8c399d7 100644
|
||||||
|
--- a/find/parser.c
|
||||||
|
+++ b/find/parser.c
|
||||||
|
@@ -2723,7 +2723,7 @@ insert_type (char **argv, int *arg_ptr,
|
||||||
|
const struct parser_table *entry,
|
||||||
|
PRED_FUNC which_pred)
|
||||||
|
{
|
||||||
|
- mode_t type_cell;
|
||||||
|
+ mode_t type_cell /* to silence GCC warning */ = 0;
|
||||||
|
struct predicate *our_pred;
|
||||||
|
float rate = 0.5;
|
||||||
|
const char *typeletter;
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
||||||
|
@ -6,9 +6,24 @@ Subject: [PATCH 1/2] Revert "Don't include dblocation.texi from original spot,
|
|||||||
|
|
||||||
This reverts commit f59d88e456553dfe0b5185caf75e4041285fd595.
|
This reverts commit f59d88e456553dfe0b5185caf75e4041285fd595.
|
||||||
---
|
---
|
||||||
doc/Makefile.am | 7 +------
|
configure.ac | 2 +-
|
||||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
doc/Makefile.am | 8 +-------
|
||||||
|
doc/find.texi | 2 +-
|
||||||
|
3 files changed, 3 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 7962719..ce0e768 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -70,7 +70,7 @@ AC_PROG_CPP
|
||||||
|
|
||||||
|
dnl for gnulib
|
||||||
|
gl_EARLY
|
||||||
|
-AC_PROG_LN_S
|
||||||
|
+
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
AC_CHECK_TOOLS([AR], [ar])
|
||||||
|
AC_CHECK_TOOLS([RANLIB], [ranlib], [:])
|
||||||
diff --git a/doc/Makefile.am b/doc/Makefile.am
|
diff --git a/doc/Makefile.am b/doc/Makefile.am
|
||||||
index f6f7443..6fbf57b 100644
|
index f6f7443..6fbf57b 100644
|
||||||
--- a/doc/Makefile.am
|
--- a/doc/Makefile.am
|
||||||
@ -21,21 +36,32 @@ index f6f7443..6fbf57b 100644
|
|||||||
-nodist_find_TEXINFOS = dblocation.texi
|
-nodist_find_TEXINFOS = dblocation.texi
|
||||||
find_maint_TEXINFOS = fdl.texi
|
find_maint_TEXINFOS = fdl.texi
|
||||||
MOSTLYCLEANFILES = find.cps
|
MOSTLYCLEANFILES = find.cps
|
||||||
-CLEANFILES = find.txt find_mono.html findutils.texi_html_node.tar.gz dblocation.texi \
|
-CLEANFILES = find.txt find_mono.html findutils.texi_html_node.tar.gz dblocation.texi
|
||||||
+CLEANFILES = find.txt find_mono.html findutils.texi_html_node.tar.gz \
|
+CLEANFILES = find.txt find_mono.html findutils.texi_html_node.tar.gz
|
||||||
find_mono.html findutils.texi_html_node.tar.gz \
|
|
||||||
find-info.tar.gz find.texi.tar.gz \
|
|
||||||
find.txt tmp-doc-install find_mono.html.gz
|
|
||||||
@@ -73,9 +71,6 @@ findutils.texi_html_node.tar.gz: find.html
|
|
||||||
tar zcf $@ find.html
|
|
||||||
|
|
||||||
|
MAKEINFOTXT = $(MAKEINFO) --plaintext
|
||||||
|
|
||||||
|
@@ -69,7 +67,3 @@ find_mono.html: find.texi
|
||||||
|
# for "make all" or "make install" (or even "make check").
|
||||||
|
findutils.texi_html_node.tar.gz: find.html
|
||||||
|
tar zcf $@ $<
|
||||||
|
-
|
||||||
|
-
|
||||||
-dblocation.texi: ../locate/dblocation.texi
|
-dblocation.texi: ../locate/dblocation.texi
|
||||||
- $(LN_S) ../locate/dblocation.texi $@
|
- $(LN_S) ../locate/dblocation.texi $@
|
||||||
-
|
diff --git a/doc/find.texi b/doc/find.texi
|
||||||
find-info.tar.gz:
|
index a83a645..c2714dd 100644
|
||||||
$(MKDIR_P) tmp-doc-install/info
|
--- a/doc/find.texi
|
||||||
$(MAKE) $(AM_MAKEFLAGS) \
|
+++ b/doc/find.texi
|
||||||
|
@@ -7,7 +7,7 @@
|
||||||
|
@c %**end of header
|
||||||
|
|
||||||
|
@include version.texi
|
||||||
|
-@include dblocation.texi
|
||||||
|
+@include ../locate/dblocation.texi
|
||||||
|
|
||||||
|
@iftex
|
||||||
|
@finalout
|
||||||
--
|
--
|
||||||
2.5.0
|
2.5.0
|
||||||
|
|
||||||
@ -46,30 +72,29 @@ Date: Wed, 11 May 2011 16:46:13 +0200
|
|||||||
Subject: [PATCH 2/2] findutils-4.4.0-no-locate.patch
|
Subject: [PATCH 2/2] findutils-4.4.0-no-locate.patch
|
||||||
|
|
||||||
---
|
---
|
||||||
Makefile.am | 2 +-
|
Makefile.am | 2 +-
|
||||||
configure.ac | 2 --
|
configure.ac | 2 --
|
||||||
doc/find.texi | 24 ++++++++----------------
|
doc/find.texi | 24 ++++++++----------------
|
||||||
tests/local.mk | 2 +-
|
3 files changed, 9 insertions(+), 19 deletions(-)
|
||||||
4 files changed, 10 insertions(+), 20 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile.am b/Makefile.am
|
diff --git a/Makefile.am b/Makefile.am
|
||||||
index af82d54..6ad453b 100644
|
index af82d54..6ad453b 100644
|
||||||
--- a/Makefile.am
|
--- a/Makefile.am
|
||||||
+++ b/Makefile.am
|
+++ b/Makefile.am
|
||||||
@@ -35,7 +35,7 @@ DISTCLEANFILES = tool-versions.txt
|
@@ -9,7 +9,7 @@ DISTCLEANFILES = tool-versions.txt
|
||||||
|
|
||||||
|
|
||||||
# "gnulib-tests" is the gnulib unit test dir.
|
# "tests" is the gnulib unit test dir.
|
||||||
-SUBDIRS = gl build-aux lib find xargs locate doc po m4 gnulib-tests
|
-SUBDIRS = gl tests build-aux lib find xargs locate doc po m4
|
||||||
+SUBDIRS = gl build-aux lib find xargs doc po m4 gnulib-tests
|
+SUBDIRS = gl tests build-aux lib find xargs doc po m4
|
||||||
|
|
||||||
ALL_RECURSIVE_TARGETS =
|
ACLOCAL_AMFLAGS = -I gl/m4 -I m4
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
diff --git a/configure.ac b/configure.ac
|
||||||
index ce0e768..521e665 100644
|
index ce0e768..521e665 100644
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -309,8 +309,6 @@ find/testsuite/Makefile
|
@@ -248,8 +248,6 @@ find/testsuite/Makefile
|
||||||
gl/Makefile
|
gl/Makefile
|
||||||
gl/lib/Makefile
|
gl/lib/Makefile
|
||||||
lib/Makefile
|
lib/Makefile
|
||||||
@ -83,14 +108,14 @@ index c2714dd..01367a4 100644
|
|||||||
--- a/doc/find.texi
|
--- a/doc/find.texi
|
||||||
+++ b/doc/find.texi
|
+++ b/doc/find.texi
|
||||||
@@ -7,7 +7,6 @@
|
@@ -7,7 +7,6 @@
|
||||||
@c @setchapternewpage odd
|
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
|
|
||||||
-@include dblocation.texi
|
@include version.texi
|
||||||
|
-@include ../locate/dblocation.texi
|
||||||
|
|
||||||
@iftex
|
@iftex
|
||||||
@finalout
|
@finalout
|
||||||
@@ -572,8 +571,7 @@ the databases are updated, and the directories for which they contain
|
@@ -571,8 +570,7 @@ the databases are updated, and the directories for which they contain
|
||||||
entries.
|
entries.
|
||||||
|
|
||||||
Here is how to select which file name databases @code{locate}
|
Here is how to select which file name databases @code{locate}
|
||||||
@ -100,7 +125,7 @@ index c2714dd..01367a4 100644
|
|||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item --database=@var{path}
|
@item --database=@var{path}
|
||||||
@@ -2993,13 +2991,9 @@ thrashing the network.
|
@@ -2892,13 +2890,9 @@ thrashing the network.
|
||||||
directories are indexed by each database file.
|
directories are indexed by each database file.
|
||||||
|
|
||||||
The default location for the locate database depends on how findutils
|
The default location for the locate database depends on how findutils
|
||||||
@ -117,7 +142,7 @@ index c2714dd..01367a4 100644
|
|||||||
|
|
||||||
@node Database Formats
|
@node Database Formats
|
||||||
@section Database Formats
|
@section Database Formats
|
||||||
@@ -3508,8 +3502,7 @@ present.
|
@@ -3438,8 +3432,7 @@ present.
|
||||||
|
|
||||||
@item --database=@var{path}
|
@item --database=@var{path}
|
||||||
@itemx -d @var{path}
|
@itemx -d @var{path}
|
||||||
@ -127,7 +152,7 @@ index c2714dd..01367a4 100644
|
|||||||
name databases in @var{path}, which is a colon-separated list of
|
name databases in @var{path}, which is a colon-separated list of
|
||||||
database file names. You can also use the environment variable
|
database file names. You can also use the environment variable
|
||||||
@code{LOCATE_PATH} to set the list of database files to search. The
|
@code{LOCATE_PATH} to set the list of database files to search. The
|
||||||
@@ -3684,8 +3677,7 @@ The environment variable @code{PRUNEFS} also sets this value. Default
|
@@ -3614,8 +3607,7 @@ The environment variable @code{PRUNEFS} also sets this value. Default
|
||||||
is @file{nfs NFS proc}.
|
is @file{nfs NFS proc}.
|
||||||
|
|
||||||
@item --output=@var{dbfile}
|
@item --output=@var{dbfile}
|
||||||
@ -137,7 +162,7 @@ index c2714dd..01367a4 100644
|
|||||||
|
|
||||||
@item --localuser=@var{user}
|
@item --localuser=@var{user}
|
||||||
The user to search the non-network directories as, using @code{su}.
|
The user to search the non-network directories as, using @code{su}.
|
||||||
@@ -5709,7 +5701,7 @@ See the manual of the system call @code{dup2(2)}.
|
@@ -5635,7 +5627,7 @@ why @code{xargs} is confused by your operating system).
|
||||||
@section Error Messages From @code{locate}
|
@section Error Messages From @code{locate}
|
||||||
|
|
||||||
@table @samp
|
@table @samp
|
||||||
@ -146,7 +171,7 @@ index c2714dd..01367a4 100644
|
|||||||
The @code{locate} program relies on a database which is periodically
|
The @code{locate} program relies on a database which is periodically
|
||||||
built by the @code{updatedb} program. That hasn't happened in a long
|
built by the @code{updatedb} program. That hasn't happened in a long
|
||||||
time. To fix this problem, run @code{updatedb} manually. This can
|
time. To fix this problem, run @code{updatedb} manually. This can
|
||||||
@@ -5717,7 +5709,7 @@ often happen on systems that are generally not left on, so the
|
@@ -5643,7 +5635,7 @@ often happen on systems that are generally not left on, so the
|
||||||
periodic ``cron'' task which normally does this doesn't get a chance
|
periodic ``cron'' task which normally does this doesn't get a chance
|
||||||
to run.
|
to run.
|
||||||
|
|
||||||
@ -155,19 +180,6 @@ index c2714dd..01367a4 100644
|
|||||||
This should not happen. Re-run @code{updatedb}. If that works, but
|
This should not happen. Re-run @code{updatedb}. If that works, but
|
||||||
@code{locate} still produces this error, run @code{locate --version}
|
@code{locate} still produces this error, run @code{locate --version}
|
||||||
and @code{updatedb --version}. These should produce the same output.
|
and @code{updatedb --version}. These should produce the same output.
|
||||||
diff --git a/tests/local.mk b/tests/local.mk
|
|
||||||
index 7e52a04..ae08a56 100644
|
|
||||||
--- a/tests/local.mk
|
|
||||||
+++ b/tests/local.mk
|
|
||||||
@@ -15,7 +15,7 @@
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
-built_programs = find oldfind xargs frcode locate updatedb
|
|
||||||
+built_programs = find oldfind xargs
|
|
||||||
|
|
||||||
# Indirections required so that we'll still be able to know the
|
|
||||||
# complete list of our tests even if the user overrides TESTS
|
|
||||||
--
|
--
|
||||||
2.5.0
|
2.5.0
|
||||||
|
|
||||||
|
116
findutils-4.6.0-covscan.patch
Normal file
116
findutils-4.6.0-covscan.patch
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
From 6b041f2bd5d84003d3945fc9ae18329f024b8d2a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||||
|
Date: Thu, 2 Feb 2017 00:17:20 +0100
|
||||||
|
Subject: [PATCH 1/2] maint: avoid warnings from GCC 6.2.1
|
||||||
|
|
||||||
|
buildcmd.c: In function 'bc_push_arg':
|
||||||
|
buildcmd.c:362:11: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
|
||||||
|
if (ctl->replace_pat
|
||||||
|
^~
|
||||||
|
buildcmd.c:366:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
|
||||||
|
bc_do_exec (ctl, state);
|
||||||
|
^~~~~~~~~~
|
||||||
|
pred.c: In function 'print_optlist':
|
||||||
|
pred.c:1328:46: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'long unsigned int' [-Werror=format=]
|
||||||
|
fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits);
|
||||||
|
^
|
||||||
|
pred.c:1328:50: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'long unsigned int' [-Werror=format=]
|
||||||
|
fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits);
|
||||||
|
^
|
||||||
|
print.c: In function 'scan_for_digit_differences':
|
||||||
|
print.c:449:46: error: logical 'or' of equal expressions [-Werror=logical-op]
|
||||||
|
if (!isdigit ((unsigned char)q[i]) || !isdigit ((unsigned char)q[i]))
|
||||||
|
^~
|
||||||
|
cc1: all warnings being treated as errors
|
||||||
|
|
||||||
|
* find/pred.c (print_optlist): Use %lu for unsigned long int.
|
||||||
|
* find/print.c (scan_for_digit_differences): Check p[i] too rather than
|
||||||
|
q[i] two times.
|
||||||
|
* lib/buildcmd.c (bc_push_arg): Fix indentation.
|
||||||
|
Use %lu format for unsigned long int.
|
||||||
|
|
||||||
|
Upstream-commit: 4bbc9e7a4a46d83ac5316cc5a57ad7ec5e12f74c
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
find/pred.c | 2 +-
|
||||||
|
find/print.c | 2 +-
|
||||||
|
lib/buildcmd.c | 2 +-
|
||||||
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/find/pred.c b/find/pred.c
|
||||||
|
index 32938fb..5c8086e 100644
|
||||||
|
--- a/find/pred.c
|
||||||
|
+++ b/find/pred.c
|
||||||
|
@@ -1278,7 +1278,7 @@ print_optlist (FILE *fp, const struct predicate *p)
|
||||||
|
fprintf (fp, " [%g] ", p->est_success_rate);
|
||||||
|
if (options.debug_options & DebugSuccessRates)
|
||||||
|
{
|
||||||
|
- fprintf (fp, "[%ld/%ld", p->perf.successes, p->perf.visits);
|
||||||
|
+ fprintf (fp, "[%lu/%lu", p->perf.successes, p->perf.visits);
|
||||||
|
if (p->perf.visits)
|
||||||
|
{
|
||||||
|
double real_rate = (double)p->perf.successes / (double)p->perf.visits;
|
||||||
|
diff --git a/find/print.c b/find/print.c
|
||||||
|
index e4c28ad..17b9320 100644
|
||||||
|
--- a/find/print.c
|
||||||
|
+++ b/find/print.c
|
||||||
|
@@ -451,7 +451,7 @@ scan_for_digit_differences (const char *p, const char *q,
|
||||||
|
{
|
||||||
|
if (p[i] != q[i])
|
||||||
|
{
|
||||||
|
- if (!isdigit ((unsigned char)q[i]) || !isdigit ((unsigned char)q[i]))
|
||||||
|
+ if (!isdigit ((unsigned char)p[i]) || !isdigit ((unsigned char)q[i]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!seen)
|
||||||
|
diff --git a/lib/buildcmd.c b/lib/buildcmd.c
|
||||||
|
index a58f67e..016ab1d 100644
|
||||||
|
--- a/lib/buildcmd.c
|
||||||
|
+++ b/lib/buildcmd.c
|
||||||
|
@@ -374,7 +374,7 @@ bc_push_arg (struct buildcmd_control *ctl,
|
||||||
|
|| (ctl->exit_if_size_exceeded &&
|
||||||
|
(ctl->lines_per_exec || ctl->args_per_exec)))
|
||||||
|
error (EXIT_FAILURE, 0, _("argument list too long"));
|
||||||
|
- bc_do_exec (ctl, state);
|
||||||
|
+ bc_do_exec (ctl, state);
|
||||||
|
}
|
||||||
|
if (bc_argc_limit_reached (initial_args, ctl, state))
|
||||||
|
bc_do_exec (ctl, state);
|
||||||
|
--
|
||||||
|
2.17.2
|
||||||
|
|
||||||
|
|
||||||
|
From 55691f606c8aefa29a4b2f3061797e7f2b85981c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||||
|
Date: Sun, 4 Feb 2018 18:20:25 +0100
|
||||||
|
Subject: [PATCH 2/2] maint: add missing va_end
|
||||||
|
|
||||||
|
'va_start' must have a corresponding 'va_end'. Depending on the
|
||||||
|
implementation, the consequence of a missing 'va_end' may be a
|
||||||
|
corrupted stack.
|
||||||
|
|
||||||
|
* find/print.c (checked_fprintf): Add va_end.
|
||||||
|
|
||||||
|
Spotted by coverity analysis.
|
||||||
|
|
||||||
|
Upstream-commit: 76d7e2dcb45a3a558033209982772d21f68a6ea4
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
find/print.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/find/print.c b/find/print.c
|
||||||
|
index 17b9320..ab1afc1 100644
|
||||||
|
--- a/find/print.c
|
||||||
|
+++ b/find/print.c
|
||||||
|
@@ -810,6 +810,7 @@ checked_fprintf (struct format_val *dest, const char *fmt, ...)
|
||||||
|
|
||||||
|
va_start (ap, fmt);
|
||||||
|
rv = vfprintf (dest->stream, fmt, ap);
|
||||||
|
+ va_end (ap);
|
||||||
|
if (rv < 0)
|
||||||
|
nonfatal_nontarget_file_error (errno, dest->filename);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.17.2
|
||||||
|
|
226
findutils-4.6.0-exec-args.patch
Normal file
226
findutils-4.6.0-exec-args.patch
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
From 443166adaf1c8b91e16a716f3b13f47493b895cc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||||
|
Date: Tue, 31 May 2016 10:38:52 +0200
|
||||||
|
Subject: [PATCH] Fix bug #48030: find: -exec + does not pass all arguments in
|
||||||
|
certain cases
|
||||||
|
|
||||||
|
When the -exec arguments buffer (usually 128k) is full and the given
|
||||||
|
command has been executed with all that arguments, find(1) missed to
|
||||||
|
execute the command yet another time if only 1 another file would have
|
||||||
|
to be processed.
|
||||||
|
Both find(1), i.e., nowadays FTS-version, and oldfind are affected.
|
||||||
|
This bug was present since the implementation of '-exec +' in 2005,
|
||||||
|
see commit FINDUTILS_4_2_11-1-25-gf0a6ac6.
|
||||||
|
|
||||||
|
* lib/buildcmd.c (bc_push_arg): Move the assignment to set 'state->todo'
|
||||||
|
to 1 down after the immediate execution which resets that flag.
|
||||||
|
* find/testsuite/sv-48030-exec-plus-bug.sh: Add a test.
|
||||||
|
* find/testsuite/Makefile.am (test_shell_progs): Reference the test.
|
||||||
|
* NEWS (Bug Fixes): Mention the fix.
|
||||||
|
|
||||||
|
Reported by Joe Philip Ninan <indiajoe@gmail.com> in
|
||||||
|
https://savannah.gnu.org/bugs/?48030
|
||||||
|
|
||||||
|
Upstream-commit: 8cdc9767e305c9566f537af9d1acf71d1bc6ee8e
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
find/testsuite/Makefile.am | 3 +-
|
||||||
|
find/testsuite/sv-48030-exec-plus-bug.sh | 143 +++++++++++++++++++++++++++++++
|
||||||
|
lib/buildcmd.c | 10 +--
|
||||||
|
3 files changed, 150 insertions(+), 6 deletions(-)
|
||||||
|
create mode 100644 find/testsuite/sv-48030-exec-plus-bug.sh
|
||||||
|
|
||||||
|
diff --git a/find/testsuite/Makefile.am b/find/testsuite/Makefile.am
|
||||||
|
index c1369c3..ab5dbe8 100644
|
||||||
|
--- a/find/testsuite/Makefile.am
|
||||||
|
+++ b/find/testsuite/Makefile.am
|
||||||
|
@@ -258,7 +258,8 @@ test_escapechars.sh \
|
||||||
|
test_escape_c.sh \
|
||||||
|
test_inode.sh \
|
||||||
|
sv-34079.sh \
|
||||||
|
-sv-34976-execdir-fd-leak.sh
|
||||||
|
+sv-34976-execdir-fd-leak.sh \
|
||||||
|
+sv-48030-exec-plus-bug.sh
|
||||||
|
|
||||||
|
EXTRA_DIST = $(EXTRA_DIST_EXP) $(EXTRA_DIST_XO) $(EXTRA_DIST_GOLDEN) \
|
||||||
|
$(test_shell_progs) binary_locations.sh checklists.py
|
||||||
|
diff --git a/find/testsuite/sv-48030-exec-plus-bug.sh b/find/testsuite/sv-48030-exec-plus-bug.sh
|
||||||
|
new file mode 100755
|
||||||
|
index 0000000..4dbf149
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/find/testsuite/sv-48030-exec-plus-bug.sh
|
||||||
|
@@ -0,0 +1,143 @@
|
||||||
|
+#! /bin/sh
|
||||||
|
+# Copyright (C) 2016 Free Software Foundation, Inc.
|
||||||
|
+#
|
||||||
|
+# This program is free software: you can redistribute it and/or modify
|
||||||
|
+# it under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+#
|
||||||
|
+# This program is distributed in the hope that it will be useful,
|
||||||
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+# GNU General Public License for more details.
|
||||||
|
+#
|
||||||
|
+# You should have received a copy of the GNU General Public License
|
||||||
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+# This test verifies that find invokes the given command for the
|
||||||
|
+# multiple-argument sytax '-exec CMD {} +'. Between FINDUTILS-4.2.12
|
||||||
|
+# and v4.6.0, find(1) would have failed to execute CMD another time
|
||||||
|
+# if there was only one last single file argument.
|
||||||
|
+
|
||||||
|
+testname="$(basename $0)"
|
||||||
|
+
|
||||||
|
+. "${srcdir}"/binary_locations.sh
|
||||||
|
+
|
||||||
|
+die() {
|
||||||
|
+ echo "$@" >&2
|
||||||
|
+ exit 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# This is used to simplify checking of the return value
|
||||||
|
+# which is useful when ensuring a command fails as desired.
|
||||||
|
+# I.e., just doing `command ... &&fail=1` will not catch
|
||||||
|
+# a segfault in command for example. With this helper you
|
||||||
|
+# instead check an explicit exit code like
|
||||||
|
+# returns_ 1 command ... || fail
|
||||||
|
+returns_ () {
|
||||||
|
+ # Disable tracing so it doesn't interfere with stderr of the wrapped command
|
||||||
|
+ { set +x; } 2>/dev/null
|
||||||
|
+
|
||||||
|
+ local exp_exit="$1"
|
||||||
|
+ shift
|
||||||
|
+ "$@"
|
||||||
|
+ test $? -eq $exp_exit && ret_=0 || ret_=1
|
||||||
|
+
|
||||||
|
+ set -x
|
||||||
|
+ { return $ret_; } 2>/dev/null
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Define the nicest compare available (borrowed from gnulib).
|
||||||
|
+if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" < /dev/null` \
|
||||||
|
+ && diff -u Makefile "$0" 2>/dev/null | grep '^[+]#!' >/dev/null; then
|
||||||
|
+ # diff accepts the -u option and does not (like AIX 7 'diff') produce an
|
||||||
|
+ # extra space on column 1 of every content line.
|
||||||
|
+ if test -z "$diff_out_"; then
|
||||||
|
+ compare () { diff -u "$@"; }
|
||||||
|
+ else
|
||||||
|
+ compare ()
|
||||||
|
+ {
|
||||||
|
+ if diff -u "$@" > diff.out; then
|
||||||
|
+ # No differences were found, but Solaris 'diff' produces output
|
||||||
|
+ # "No differences encountered". Hide this output.
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ true
|
||||||
|
+ else
|
||||||
|
+ cat diff.out
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ false
|
||||||
|
+ fi
|
||||||
|
+ }
|
||||||
|
+ fi
|
||||||
|
+elif diff_out_=`exec 2>/dev/null; diff -c "$0" "$0" < /dev/null`; then
|
||||||
|
+ if test -z "$diff_out_"; then
|
||||||
|
+ compare () { diff -c "$@"; }
|
||||||
|
+ else
|
||||||
|
+ compare ()
|
||||||
|
+ {
|
||||||
|
+ if diff -c "$@" > diff.out; then
|
||||||
|
+ # No differences were found, but AIX and HP-UX 'diff' produce output
|
||||||
|
+ # "No differences encountered" or "There are no differences between the
|
||||||
|
+ # files.". Hide this output.
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ true
|
||||||
|
+ else
|
||||||
|
+ cat diff.out
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ false
|
||||||
|
+ fi
|
||||||
|
+ }
|
||||||
|
+ fi
|
||||||
|
+elif cmp -s /dev/null /dev/null 2>/dev/null; then
|
||||||
|
+ compare () { cmp -s "$@"; }
|
||||||
|
+else
|
||||||
|
+ compare () { cmp "$@"; }
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+DIR='RashuBug'
|
||||||
|
+# Name of the CMD to execute: the file name must be 6 characters long
|
||||||
|
+# (to trigger the bug in combination with the test files).
|
||||||
|
+CMD='tstcmd'
|
||||||
|
+
|
||||||
|
+# Create test files.
|
||||||
|
+make_test_data() {
|
||||||
|
+ # Create the CMD script and check that it works.
|
||||||
|
+ mkdir "$DIR" 'bin' \
|
||||||
|
+ && echo 'printf "%s\n" "$@"' > "bin/$CMD" \
|
||||||
|
+ && chmod +x "bin/$CMD" \
|
||||||
|
+ && PATH="$PWD/bin:$PATH" \
|
||||||
|
+ && [ $( "${ftsfind}" bin -maxdepth 0 -exec "$CMD" '{}' + ) = 'bin' ] \
|
||||||
|
+ || return 1
|
||||||
|
+
|
||||||
|
+ # Create expected output file - also used for creating the test data.
|
||||||
|
+ { seq -f "${DIR}/abcdefghijklmnopqrstuv%04g" 901 &&
|
||||||
|
+ seq -f "${DIR}/abcdefghijklmnopqrstu%04g" 902 3719
|
||||||
|
+ } > exp2 \
|
||||||
|
+ && LC_ALL=C sort exp2 > exp \
|
||||||
|
+ && rm exp2 \
|
||||||
|
+ || return 1
|
||||||
|
+
|
||||||
|
+ # Create test files, and check if test data has been created correctly.
|
||||||
|
+ xargs touch < exp \
|
||||||
|
+ && [ -f "${DIR}/abcdefghijklmnopqrstu3719" ] \
|
||||||
|
+ && [ 3719 = $( "${ftsfind}" "$DIR" -type f | wc -l ) ] \
|
||||||
|
+ || return 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+set -x
|
||||||
|
+tmpdir="$(mktemp -d)" \
|
||||||
|
+ && cd "$tmpdir" \
|
||||||
|
+ && make_test_data "${tmpdir}" \
|
||||||
|
+ || die "FAIL: failed to set up the test in ${tmpdir}"
|
||||||
|
+
|
||||||
|
+fail=0
|
||||||
|
+for exe in "${ftsfind}" "${oldfind}"; do
|
||||||
|
+ "$exe" "$DIR" -type f -exec "$CMD" '{}' + > out || fail=1
|
||||||
|
+ LC_ALL=C sort out > out2 || fail=1
|
||||||
|
+ compare exp out2 || fail=1
|
||||||
|
+done
|
||||||
|
+
|
||||||
|
+cd ..
|
||||||
|
+rm -rf "${tmpdir}" || exit 1
|
||||||
|
+exit $fail
|
||||||
|
diff --git a/lib/buildcmd.c b/lib/buildcmd.c
|
||||||
|
index a58f67e..27e9ce5 100644
|
||||||
|
--- a/lib/buildcmd.c
|
||||||
|
+++ b/lib/buildcmd.c
|
||||||
|
@@ -356,11 +356,6 @@ bc_push_arg (struct buildcmd_control *ctl,
|
||||||
|
|
||||||
|
assert (arg != NULL);
|
||||||
|
|
||||||
|
- if (!initial_args)
|
||||||
|
- {
|
||||||
|
- state->todo = 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
if (!terminate)
|
||||||
|
{
|
||||||
|
if (state->cmd_argv_chars + len + pfxlen > ctl->arg_max)
|
||||||
|
@@ -380,6 +375,11 @@ bc_push_arg (struct buildcmd_control *ctl,
|
||||||
|
bc_do_exec (ctl, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (!initial_args)
|
||||||
|
+ {
|
||||||
|
+ state->todo = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (state->cmd_argc >= state->cmd_argv_alloc)
|
||||||
|
{
|
||||||
|
/* XXX: we could use extendbuf() here. */
|
||||||
|
--
|
||||||
|
2.5.5
|
||||||
|
|
990
findutils-4.6.0-fts-update.patch
Normal file
990
findutils-4.6.0-fts-update.patch
Normal file
@ -0,0 +1,990 @@
|
|||||||
|
From f3337786e55909538aacfd7c29b1cf58ff444fbf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
Date: Mon, 12 Feb 2018 12:45:36 +0100
|
||||||
|
Subject: [PATCH 1/4] import gnulib's FTS module from upstream commit 281b825e
|
||||||
|
|
||||||
|
---
|
||||||
|
gl/lib/fts.c | 424 +++++++++++++++++++++++++++++-----------------------------
|
||||||
|
gl/lib/fts_.h | 10 +-
|
||||||
|
2 files changed, 221 insertions(+), 213 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
|
||||||
|
index c91d7a1..bfa73e3 100644
|
||||||
|
--- a/gl/lib/fts.c
|
||||||
|
+++ b/gl/lib/fts.c
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
/* Traverse a file hierarchy.
|
||||||
|
|
||||||
|
- Copyright (C) 2004-2015 Free Software Foundation, Inc.
|
||||||
|
+ Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -13,7 +13,7 @@
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 1990, 1993, 1994
|
||||||
|
@@ -46,9 +46,9 @@
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
-#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
+#if defined LIBC_SCCS && !defined GCC_LINT && !defined lint
|
||||||
|
static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
|
||||||
|
-#endif /* LIBC_SCCS and not lint */
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "fts_.h"
|
||||||
|
|
||||||
|
@@ -71,11 +71,7 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
|
||||||
|
|
||||||
|
#if ! _LIBC
|
||||||
|
# include "fcntl--.h"
|
||||||
|
-# include "dirent--.h"
|
||||||
|
-# include "unistd--.h"
|
||||||
|
-/* FIXME - use fcntl(F_DUPFD_CLOEXEC)/openat(O_CLOEXEC) once they are
|
||||||
|
- supported. */
|
||||||
|
-# include "cloexec.h"
|
||||||
|
+# include "flexmember.h"
|
||||||
|
# include "openat.h"
|
||||||
|
# include "same-inode.h"
|
||||||
|
#endif
|
||||||
|
@@ -202,6 +198,14 @@ enum Fts_stat
|
||||||
|
while (false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifndef FALLTHROUGH
|
||||||
|
+# if __GNUC__ < 7
|
||||||
|
+# define FALLTHROUGH ((void) 0)
|
||||||
|
+# else
|
||||||
|
+# define FALLTHROUGH __attribute__ ((__fallthrough__))
|
||||||
|
+# endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static FTSENT *fts_alloc (FTS *, const char *, size_t) internal_function;
|
||||||
|
static FTSENT *fts_build (FTS *, int) internal_function;
|
||||||
|
static void fts_lfree (FTSENT *) internal_function;
|
||||||
|
@@ -296,14 +300,13 @@ static DIR *
|
||||||
|
internal_function
|
||||||
|
opendirat (int fd, char const *dir, int extra_flags, int *pdir_fd)
|
||||||
|
{
|
||||||
|
- int new_fd = openat (fd, dir,
|
||||||
|
- (O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
|
||||||
|
- | extra_flags));
|
||||||
|
+ int open_flags = (O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_NOCTTY
|
||||||
|
+ | O_NONBLOCK | extra_flags);
|
||||||
|
+ int new_fd = openat (fd, dir, open_flags);
|
||||||
|
DIR *dirp;
|
||||||
|
|
||||||
|
if (new_fd < 0)
|
||||||
|
return NULL;
|
||||||
|
- set_cloexec_flag (new_fd, true);
|
||||||
|
dirp = fdopendir (new_fd);
|
||||||
|
if (dirp)
|
||||||
|
*pdir_fd = new_fd;
|
||||||
|
@@ -366,15 +369,13 @@ static int
|
||||||
|
internal_function
|
||||||
|
diropen (FTS const *sp, char const *dir)
|
||||||
|
{
|
||||||
|
- int open_flags = (O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
|
||||||
|
+ int open_flags = (O_SEARCH | O_CLOEXEC | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
|
||||||
|
| (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0)
|
||||||
|
| (ISSET (FTS_NOATIME) ? O_NOATIME : 0));
|
||||||
|
|
||||||
|
int fd = (ISSET (FTS_CWDFD)
|
||||||
|
? openat (sp->fts_cwd_fd, dir, open_flags)
|
||||||
|
: open (dir, open_flags));
|
||||||
|
- if (0 <= fd)
|
||||||
|
- set_cloexec_flag (fd, true);
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -470,6 +471,7 @@ fts_open (char * const *argv,
|
||||||
|
if ((parent = fts_alloc(sp, "", 0)) == NULL)
|
||||||
|
goto mem2;
|
||||||
|
parent->fts_level = FTS_ROOTPARENTLEVEL;
|
||||||
|
+ parent->fts_n_dirs_remaining = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The classic fts implementation would call fts_stat with
|
||||||
|
@@ -656,39 +658,139 @@ fts_close (FTS *sp)
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Minimum link count of a traditional Unix directory. When leaf
|
||||||
|
+ optimization is OK and MIN_DIR_NLINK <= st_nlink, then st_nlink is
|
||||||
|
+ an upper bound on the number of subdirectories (counting "." and
|
||||||
|
+ ".."). */
|
||||||
|
+enum { MIN_DIR_NLINK = 2 };
|
||||||
|
+
|
||||||
|
+/* Whether leaf optimization is OK for a directory. */
|
||||||
|
+enum leaf_optimization
|
||||||
|
+ {
|
||||||
|
+ /* st_nlink is not reliable for this directory's subdirectories. */
|
||||||
|
+ NO_LEAF_OPTIMIZATION,
|
||||||
|
+
|
||||||
|
+ /* Leaf optimization is OK, but is not useful for avoiding stat calls. */
|
||||||
|
+ OK_LEAF_OPTIMIZATION,
|
||||||
|
+
|
||||||
|
+ /* Leaf optimization is not only OK: it is useful for avoiding
|
||||||
|
+ stat calls, because dirent.d_type does not work. */
|
||||||
|
+ NOSTAT_LEAF_OPTIMIZATION
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
#if defined __linux__ \
|
||||||
|
&& HAVE_SYS_VFS_H && HAVE_FSTATFS && HAVE_STRUCT_STATFS_F_TYPE
|
||||||
|
|
||||||
|
# include <sys/vfs.h>
|
||||||
|
|
||||||
|
/* Linux-specific constants from coreutils' src/fs.h */
|
||||||
|
-# define S_MAGIC_TMPFS 0x1021994
|
||||||
|
+# define S_MAGIC_AFS 0x5346414F
|
||||||
|
# define S_MAGIC_NFS 0x6969
|
||||||
|
+# define S_MAGIC_PROC 0x9FA0
|
||||||
|
# define S_MAGIC_REISERFS 0x52654973
|
||||||
|
+# define S_MAGIC_TMPFS 0x1021994
|
||||||
|
# define S_MAGIC_XFS 0x58465342
|
||||||
|
-# define S_MAGIC_PROC 0x9FA0
|
||||||
|
|
||||||
|
-/* Return false if it is easy to determine the file system type of
|
||||||
|
- the directory on which DIR_FD is open, and sorting dirents on
|
||||||
|
- inode numbers is known not to improve traversal performance with
|
||||||
|
- that type of file system. Otherwise, return true. */
|
||||||
|
+# ifdef HAVE___FSWORD_T
|
||||||
|
+typedef __fsword_t fsword;
|
||||||
|
+# else
|
||||||
|
+typedef long int fsword;
|
||||||
|
+# endif
|
||||||
|
+
|
||||||
|
+/* Map a stat.st_dev number to a file system type number f_ftype. */
|
||||||
|
+struct dev_type
|
||||||
|
+{
|
||||||
|
+ dev_t st_dev;
|
||||||
|
+ fsword f_type;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* Use a tiny initial size. If a traversal encounters more than
|
||||||
|
+ a few devices, the cost of growing/rehashing this table will be
|
||||||
|
+ rendered negligible by the number of inodes processed. */
|
||||||
|
+enum { DEV_TYPE_HT_INITIAL_SIZE = 13 };
|
||||||
|
+
|
||||||
|
+static size_t
|
||||||
|
+dev_type_hash (void const *x, size_t table_size)
|
||||||
|
+{
|
||||||
|
+ struct dev_type const *ax = x;
|
||||||
|
+ uintmax_t dev = ax->st_dev;
|
||||||
|
+ return dev % table_size;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static bool
|
||||||
|
-dirent_inode_sort_may_be_useful (int dir_fd)
|
||||||
|
+dev_type_compare (void const *x, void const *y)
|
||||||
|
+{
|
||||||
|
+ struct dev_type const *ax = x;
|
||||||
|
+ struct dev_type const *ay = y;
|
||||||
|
+ return ax->st_dev == ay->st_dev;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Return the file system type of P, or 0 if not known.
|
||||||
|
+ Try to cache known values. */
|
||||||
|
+
|
||||||
|
+static fsword
|
||||||
|
+filesystem_type (FTSENT const *p)
|
||||||
|
+{
|
||||||
|
+ FTS *sp = p->fts_fts;
|
||||||
|
+ Hash_table *h = sp->fts_leaf_optimization_works_ht;
|
||||||
|
+ struct dev_type *ent;
|
||||||
|
+ struct statfs fs_buf;
|
||||||
|
+
|
||||||
|
+ /* If we're not in CWDFD mode, don't bother with this optimization,
|
||||||
|
+ since the caller is not serious about performance. */
|
||||||
|
+ if (!ISSET (FTS_CWDFD))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (! h)
|
||||||
|
+ h = sp->fts_leaf_optimization_works_ht
|
||||||
|
+ = hash_initialize (DEV_TYPE_HT_INITIAL_SIZE, NULL, dev_type_hash,
|
||||||
|
+ dev_type_compare, free);
|
||||||
|
+ if (h)
|
||||||
|
+ {
|
||||||
|
+ struct dev_type tmp;
|
||||||
|
+ tmp.st_dev = p->fts_statp->st_dev;
|
||||||
|
+ ent = hash_lookup (h, &tmp);
|
||||||
|
+ if (ent)
|
||||||
|
+ return ent->f_type;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Look-up failed. Query directly and cache the result. */
|
||||||
|
+ if (fstatfs (p->fts_fts->fts_cwd_fd, &fs_buf) != 0)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (h)
|
||||||
|
+ {
|
||||||
|
+ struct dev_type *t2 = malloc (sizeof *t2);
|
||||||
|
+ if (t2)
|
||||||
|
+ {
|
||||||
|
+ t2->st_dev = p->fts_statp->st_dev;
|
||||||
|
+ t2->f_type = fs_buf.f_type;
|
||||||
|
+
|
||||||
|
+ ent = hash_insert (h, t2);
|
||||||
|
+ if (ent)
|
||||||
|
+ fts_assert (ent == t2);
|
||||||
|
+ else
|
||||||
|
+ free (t2);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return fs_buf.f_type;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Return false if it is easy to determine the file system type of the
|
||||||
|
+ directory P, and sorting dirents on inode numbers is known not to
|
||||||
|
+ improve traversal performance with that type of file system.
|
||||||
|
+ Otherwise, return true. */
|
||||||
|
+static bool
|
||||||
|
+dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
{
|
||||||
|
/* Skip the sort only if we can determine efficiently
|
||||||
|
that skipping it is the right thing to do.
|
||||||
|
The cost of performing an unnecessary sort is negligible,
|
||||||
|
while the cost of *not* performing it can be O(N^2) with
|
||||||
|
a very large constant. */
|
||||||
|
- struct statfs fs_buf;
|
||||||
|
-
|
||||||
|
- /* If fstatfs fails, assume sorting would be useful. */
|
||||||
|
- if (fstatfs (dir_fd, &fs_buf) != 0)
|
||||||
|
- return true;
|
||||||
|
|
||||||
|
- /* FIXME: what about when f_type is not an integral type?
|
||||||
|
- deal with that if/when it's encountered. */
|
||||||
|
- switch (fs_buf.f_type)
|
||||||
|
+ switch (filesystem_type (p))
|
||||||
|
{
|
||||||
|
case S_MAGIC_TMPFS:
|
||||||
|
case S_MAGIC_NFS:
|
||||||
|
@@ -701,133 +803,58 @@ dirent_inode_sort_may_be_useful (int dir_fd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Given a file descriptor DIR_FD open on a directory D,
|
||||||
|
- return true if it is valid to apply the leaf-optimization
|
||||||
|
- technique of counting directories in D via stat.st_nlink. */
|
||||||
|
-static bool
|
||||||
|
-leaf_optimization_applies (int dir_fd)
|
||||||
|
+/* Given an FTS entry P for a directory D,
|
||||||
|
+ return true if it is both useful and valid to apply leaf optimization.
|
||||||
|
+ The optimization is useful only for file systems that lack usable
|
||||||
|
+ dirent.d_type info. The optimization is valid if an st_nlink value
|
||||||
|
+ of at least MIN_DIR_NLINK is an upper bound on the number of
|
||||||
|
+ subdirectories of D, counting "." and ".." as subdirectories. */
|
||||||
|
+static enum leaf_optimization
|
||||||
|
+leaf_optimization (FTSENT const *p)
|
||||||
|
{
|
||||||
|
- struct statfs fs_buf;
|
||||||
|
-
|
||||||
|
- /* If fstatfs fails, assume we can't use the optimization. */
|
||||||
|
- if (fstatfs (dir_fd, &fs_buf) != 0)
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- /* FIXME: do we need to detect AFS mount points? I doubt it,
|
||||||
|
- unless fstatfs can report S_MAGIC_REISERFS for such a directory. */
|
||||||
|
-
|
||||||
|
- switch (fs_buf.f_type)
|
||||||
|
+ switch (filesystem_type (p))
|
||||||
|
{
|
||||||
|
- case S_MAGIC_NFS:
|
||||||
|
- /* NFS provides usable dirent.d_type but not necessarily for all entries
|
||||||
|
- of large directories. See <https://bugzilla.redhat.com/1252549>. */
|
||||||
|
- return true;
|
||||||
|
-
|
||||||
|
- /* List here the file system types that lack usable dirent.d_type
|
||||||
|
+ /* List here the file system types that may lack usable dirent.d_type
|
||||||
|
info, yet for which the optimization does apply. */
|
||||||
|
case S_MAGIC_REISERFS:
|
||||||
|
- case S_MAGIC_XFS:
|
||||||
|
- return true;
|
||||||
|
-
|
||||||
|
+ case S_MAGIC_XFS: /* XFS lacked it until 2013-08-22 commit. */
|
||||||
|
+ return NOSTAT_LEAF_OPTIMIZATION;
|
||||||
|
+
|
||||||
|
+ case 0:
|
||||||
|
+ /* Leaf optimization is unsafe if the file system type is unknown. */
|
||||||
|
+ FALLTHROUGH;
|
||||||
|
+ case S_MAGIC_AFS:
|
||||||
|
+ /* Although AFS mount points are not counted in st_nlink, they
|
||||||
|
+ act like directories. See <https://bugs.debian.org/143111>. */
|
||||||
|
+ FALLTHROUGH;
|
||||||
|
+ case S_MAGIC_NFS:
|
||||||
|
+ /* NFS provides usable dirent.d_type but not necessarily for all entries
|
||||||
|
+ of large directories, so as per <https://bugzilla.redhat.com/1252549>
|
||||||
|
+ NFS should return true. However st_nlink values are not accurate on
|
||||||
|
+ all implementations as per <https://bugzilla.redhat.com/1299169>. */
|
||||||
|
+ FALLTHROUGH;
|
||||||
|
case S_MAGIC_PROC:
|
||||||
|
- /* Explicitly listing this or any other file system type for which
|
||||||
|
- the optimization is not applicable is not necessary, but we leave
|
||||||
|
- it here to document the risk. Per http://bugs.debian.org/143111,
|
||||||
|
- /proc may have bogus stat.st_nlink values. */
|
||||||
|
- /* fall through */
|
||||||
|
+ /* Per <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=143111> /proc
|
||||||
|
+ may have bogus stat.st_nlink values. */
|
||||||
|
+ return NO_LEAF_OPTIMIZATION;
|
||||||
|
+
|
||||||
|
default:
|
||||||
|
- return false;
|
||||||
|
+ return OK_LEAF_OPTIMIZATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
static bool
|
||||||
|
-dirent_inode_sort_may_be_useful (int dir_fd _GL_UNUSED) { return true; }
|
||||||
|
-static bool
|
||||||
|
-leaf_optimization_applies (int dir_fd _GL_UNUSED) { return false; }
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-/* link-count-optimization entry:
|
||||||
|
- map a stat.st_dev number to a boolean: leaf_optimization_works */
|
||||||
|
-struct LCO_ent
|
||||||
|
-{
|
||||||
|
- dev_t st_dev;
|
||||||
|
- bool opt_ok;
|
||||||
|
-};
|
||||||
|
-
|
||||||
|
-/* Use a tiny initial size. If a traversal encounters more than
|
||||||
|
- a few devices, the cost of growing/rehashing this table will be
|
||||||
|
- rendered negligible by the number of inodes processed. */
|
||||||
|
-enum { LCO_HT_INITIAL_SIZE = 13 };
|
||||||
|
-
|
||||||
|
-static size_t
|
||||||
|
-LCO_hash (void const *x, size_t table_size)
|
||||||
|
-{
|
||||||
|
- struct LCO_ent const *ax = x;
|
||||||
|
- return (uintmax_t) ax->st_dev % table_size;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static bool
|
||||||
|
-LCO_compare (void const *x, void const *y)
|
||||||
|
+dirent_inode_sort_may_be_useful (FTSENT const *p _GL_UNUSED)
|
||||||
|
{
|
||||||
|
- struct LCO_ent const *ax = x;
|
||||||
|
- struct LCO_ent const *ay = y;
|
||||||
|
- return ax->st_dev == ay->st_dev;
|
||||||
|
+ return true;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-/* Ask the same question as leaf_optimization_applies, but query
|
||||||
|
- the cache first (FTS.fts_leaf_optimization_works_ht), and if necessary,
|
||||||
|
- update that cache. */
|
||||||
|
-static bool
|
||||||
|
-link_count_optimize_ok (FTSENT const *p)
|
||||||
|
+static enum leaf_optimization
|
||||||
|
+leaf_optimization (FTSENT const *p _GL_UNUSED)
|
||||||
|
{
|
||||||
|
- FTS *sp = p->fts_fts;
|
||||||
|
- Hash_table *h = sp->fts_leaf_optimization_works_ht;
|
||||||
|
- struct LCO_ent tmp;
|
||||||
|
- struct LCO_ent *ent;
|
||||||
|
- bool opt_ok;
|
||||||
|
- struct LCO_ent *t2;
|
||||||
|
-
|
||||||
|
- /* If we're not in CWDFD mode, don't bother with this optimization,
|
||||||
|
- since the caller is not serious about performance. */
|
||||||
|
- if (!ISSET(FTS_CWDFD))
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- /* map st_dev to the boolean, leaf_optimization_works */
|
||||||
|
- if (h == NULL)
|
||||||
|
- {
|
||||||
|
- h = sp->fts_leaf_optimization_works_ht
|
||||||
|
- = hash_initialize (LCO_HT_INITIAL_SIZE, NULL, LCO_hash,
|
||||||
|
- LCO_compare, free);
|
||||||
|
- if (h == NULL)
|
||||||
|
- return false;
|
||||||
|
- }
|
||||||
|
- tmp.st_dev = p->fts_statp->st_dev;
|
||||||
|
- ent = hash_lookup (h, &tmp);
|
||||||
|
- if (ent)
|
||||||
|
- return ent->opt_ok;
|
||||||
|
-
|
||||||
|
- /* Look-up failed. Query directly and cache the result. */
|
||||||
|
- t2 = malloc (sizeof *t2);
|
||||||
|
- if (t2 == NULL)
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- /* Is it ok to perform the optimization in the dir, FTS_CWD_FD? */
|
||||||
|
- opt_ok = leaf_optimization_applies (sp->fts_cwd_fd);
|
||||||
|
- t2->opt_ok = opt_ok;
|
||||||
|
- t2->st_dev = p->fts_statp->st_dev;
|
||||||
|
-
|
||||||
|
- ent = hash_insert (h, t2);
|
||||||
|
- if (ent == NULL)
|
||||||
|
- {
|
||||||
|
- /* insertion failed */
|
||||||
|
- free (t2);
|
||||||
|
- return false;
|
||||||
|
- }
|
||||||
|
- fts_assert (ent == t2);
|
||||||
|
-
|
||||||
|
- return opt_ok;
|
||||||
|
+ return NO_LEAF_OPTIMIZATION;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Special case of "/" at the end of the file name so that slashes aren't
|
||||||
|
@@ -1014,13 +1041,11 @@ check_for_dir:
|
||||||
|
if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
|
||||||
|
{
|
||||||
|
FTSENT *parent = p->fts_parent;
|
||||||
|
- if (FTS_ROOTLEVEL < p->fts_level
|
||||||
|
- /* ->fts_n_dirs_remaining is not valid
|
||||||
|
- for command-line-specified names. */
|
||||||
|
- && parent->fts_n_dirs_remaining == 0
|
||||||
|
+ if (parent->fts_n_dirs_remaining == 0
|
||||||
|
&& ISSET(FTS_NOSTAT)
|
||||||
|
&& ISSET(FTS_PHYSICAL)
|
||||||
|
- && link_count_optimize_ok (parent))
|
||||||
|
+ && (leaf_optimization (parent)
|
||||||
|
+ == NOSTAT_LEAF_OPTIMIZATION))
|
||||||
|
{
|
||||||
|
/* nothing more needed */
|
||||||
|
}
|
||||||
|
@@ -1029,7 +1054,8 @@ check_for_dir:
|
||||||
|
p->fts_info = fts_stat(sp, p, false);
|
||||||
|
if (S_ISDIR(p->fts_statp->st_mode)
|
||||||
|
&& p->fts_level != FTS_ROOTLEVEL
|
||||||
|
- && parent->fts_n_dirs_remaining)
|
||||||
|
+ && 0 < parent->fts_n_dirs_remaining
|
||||||
|
+ && parent->fts_n_dirs_remaining != (nlink_t) -1)
|
||||||
|
parent->fts_n_dirs_remaining--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1298,8 +1324,6 @@ fts_build (register FTS *sp, int type)
|
||||||
|
bool descend;
|
||||||
|
bool doadjust;
|
||||||
|
ptrdiff_t level;
|
||||||
|
- nlink_t nlinks;
|
||||||
|
- bool nostat;
|
||||||
|
size_t len, maxlen, new_len;
|
||||||
|
char *cp;
|
||||||
|
int dir_fd;
|
||||||
|
@@ -1369,24 +1393,6 @@ fts_build (register FTS *sp, int type)
|
||||||
|
sorting, yet not so large that we risk exhausting memory. */
|
||||||
|
max_entries = sp->fts_compar ? SIZE_MAX : FTS_MAX_READDIR_ENTRIES;
|
||||||
|
|
||||||
|
- /*
|
||||||
|
- * Nlinks is the number of possible entries of type directory in the
|
||||||
|
- * directory if we're cheating on stat calls, 0 if we're not doing
|
||||||
|
- * any stat calls at all, (nlink_t) -1 if we're statting everything.
|
||||||
|
- */
|
||||||
|
- if (type == BNAMES) {
|
||||||
|
- nlinks = 0;
|
||||||
|
- /* Be quiet about nostat, GCC. */
|
||||||
|
- nostat = false;
|
||||||
|
- } else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL)) {
|
||||||
|
- nlinks = (cur->fts_statp->st_nlink
|
||||||
|
- - (ISSET(FTS_SEEDOT) ? 0 : 2));
|
||||||
|
- nostat = true;
|
||||||
|
- } else {
|
||||||
|
- nlinks = -1;
|
||||||
|
- nostat = false;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
/*
|
||||||
|
* If we're going to need to stat anything or we want to descend
|
||||||
|
* and stay in the directory, chdir. If this fails we keep going,
|
||||||
|
@@ -1408,15 +1414,22 @@ fts_build (register FTS *sp, int type)
|
||||||
|
the required dirp and dir_fd. */
|
||||||
|
descend = true;
|
||||||
|
}
|
||||||
|
- else if (nlinks || type == BREAD) {
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ /* Try to descend unless it is a names-only fts_children,
|
||||||
|
+ or the directory is known to lack subdirectories. */
|
||||||
|
+ descend = (type != BNAMES
|
||||||
|
+ && ! (ISSET (FTS_NOSTAT) && ISSET (FTS_PHYSICAL)
|
||||||
|
+ && ! ISSET (FTS_SEEDOT)
|
||||||
|
+ && cur->fts_statp->st_nlink == MIN_DIR_NLINK
|
||||||
|
+ && (leaf_optimization (cur)
|
||||||
|
+ != NO_LEAF_OPTIMIZATION)));
|
||||||
|
+ if (descend || type == BREAD)
|
||||||
|
+ {
|
||||||
|
if (ISSET(FTS_CWDFD))
|
||||||
|
- {
|
||||||
|
- dir_fd = dup (dir_fd);
|
||||||
|
- if (0 <= dir_fd)
|
||||||
|
- set_cloexec_flag (dir_fd, true);
|
||||||
|
- }
|
||||||
|
+ dir_fd = fcntl (dir_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
|
||||||
|
if (dir_fd < 0 || fts_safe_changedir(sp, cur, dir_fd, NULL)) {
|
||||||
|
- if (nlinks && type == BREAD)
|
||||||
|
+ if (descend && type == BREAD)
|
||||||
|
cur->fts_errno = errno;
|
||||||
|
cur->fts_flags |= FTS_DONTCHDIR;
|
||||||
|
descend = false;
|
||||||
|
@@ -1426,8 +1439,8 @@ fts_build (register FTS *sp, int type)
|
||||||
|
cur->fts_dirp = NULL;
|
||||||
|
} else
|
||||||
|
descend = true;
|
||||||
|
- } else
|
||||||
|
- descend = false;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Figure out the max file name length that can be stored in the
|
||||||
|
@@ -1458,11 +1471,19 @@ fts_build (register FTS *sp, int type)
|
||||||
|
tail = NULL;
|
||||||
|
nitems = 0;
|
||||||
|
while (cur->fts_dirp) {
|
||||||
|
- bool is_dir;
|
||||||
|
size_t d_namelen;
|
||||||
|
+ __set_errno (0);
|
||||||
|
struct dirent *dp = readdir(cur->fts_dirp);
|
||||||
|
- if (dp == NULL)
|
||||||
|
+ if (dp == NULL) {
|
||||||
|
+ if (errno) {
|
||||||
|
+ cur->fts_errno = errno;
|
||||||
|
+ /* If we've not read any items yet, treat
|
||||||
|
+ the error as if we can't access the dir. */
|
||||||
|
+ cur->fts_info = (continue_readdir || nitems)
|
||||||
|
+ ? FTS_ERR : FTS_DNR;
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
+ }
|
||||||
|
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
@@ -1550,19 +1571,10 @@ mem1: saved_errno = errno;
|
||||||
|
to caller, when possible. */
|
||||||
|
set_stat_type (p->fts_statp, D_TYPE (dp));
|
||||||
|
fts_set_stat_required(p, !skip_stat);
|
||||||
|
- is_dir = (ISSET(FTS_PHYSICAL)
|
||||||
|
- && DT_MUST_BE(dp, DT_DIR));
|
||||||
|
} else {
|
||||||
|
p->fts_info = fts_stat(sp, p, false);
|
||||||
|
- is_dir = (p->fts_info == FTS_D
|
||||||
|
- || p->fts_info == FTS_DC
|
||||||
|
- || p->fts_info == FTS_DOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* Decrement link count if applicable. */
|
||||||
|
- if (nlinks > 0 && is_dir)
|
||||||
|
- nlinks -= nostat;
|
||||||
|
-
|
||||||
|
/* We walk in directory order so "ls -f" doesn't get upset. */
|
||||||
|
p->fts_link = NULL;
|
||||||
|
if (head == NULL)
|
||||||
|
@@ -1621,7 +1633,8 @@ mem1: saved_errno = errno;
|
||||||
|
|
||||||
|
/* If didn't find anything, return NULL. */
|
||||||
|
if (!nitems) {
|
||||||
|
- if (type == BREAD)
|
||||||
|
+ if (type == BREAD
|
||||||
|
+ && cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR)
|
||||||
|
cur->fts_info = FTS_DP;
|
||||||
|
fts_lfree(head);
|
||||||
|
return (NULL);
|
||||||
|
@@ -1633,8 +1646,7 @@ mem1: saved_errno = errno;
|
||||||
|
inode numbers. */
|
||||||
|
if (nitems > _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
|
||||||
|
&& !sp->fts_compar
|
||||||
|
- && ISSET (FTS_CWDFD)
|
||||||
|
- && dirent_inode_sort_may_be_useful (sp->fts_cwd_fd)) {
|
||||||
|
+ && dirent_inode_sort_may_be_useful (cur)) {
|
||||||
|
sp->fts_compar = fts_compare_ino;
|
||||||
|
head = fts_sort (sp, head, nitems);
|
||||||
|
sp->fts_compar = NULL;
|
||||||
|
@@ -1757,7 +1769,7 @@ fd_ring_check (FTS const *sp)
|
||||||
|
I_ring fd_w = sp->fts_fd_ring;
|
||||||
|
|
||||||
|
int cwd_fd = sp->fts_cwd_fd;
|
||||||
|
- cwd_fd = dup (cwd_fd);
|
||||||
|
+ cwd_fd = fcntl (cwd_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
|
||||||
|
char *dot = getcwdat (cwd_fd, NULL, 0);
|
||||||
|
error (0, 0, "===== check ===== cwd: %s", dot);
|
||||||
|
free (dot);
|
||||||
|
@@ -1766,7 +1778,8 @@ fd_ring_check (FTS const *sp)
|
||||||
|
int fd = i_ring_pop (&fd_w);
|
||||||
|
if (0 <= fd)
|
||||||
|
{
|
||||||
|
- int parent_fd = openat (cwd_fd, "..", O_SEARCH | O_NOATIME);
|
||||||
|
+ int open_flags = O_SEARCH | O_CLOEXEC | O_NOATIME;
|
||||||
|
+ int parent_fd = openat (cwd_fd, "..", open_flags);
|
||||||
|
if (parent_fd < 0)
|
||||||
|
{
|
||||||
|
// Warn?
|
||||||
|
@@ -1795,7 +1808,6 @@ internal_function
|
||||||
|
fts_stat(FTS *sp, register FTSENT *p, bool follow)
|
||||||
|
{
|
||||||
|
struct stat *sbp = p->fts_statp;
|
||||||
|
- int saved_errno;
|
||||||
|
|
||||||
|
if (p->fts_level == FTS_ROOTLEVEL && ISSET(FTS_COMFOLLOW))
|
||||||
|
follow = true;
|
||||||
|
@@ -1807,13 +1819,12 @@ fts_stat(FTS *sp, register FTSENT *p, bool follow)
|
||||||
|
*/
|
||||||
|
if (ISSET(FTS_LOGICAL) || follow) {
|
||||||
|
if (stat(p->fts_accpath, sbp)) {
|
||||||
|
- saved_errno = errno;
|
||||||
|
if (errno == ENOENT
|
||||||
|
&& lstat(p->fts_accpath, sbp) == 0) {
|
||||||
|
__set_errno (0);
|
||||||
|
return (FTS_SLNONE);
|
||||||
|
}
|
||||||
|
- p->fts_errno = saved_errno;
|
||||||
|
+ p->fts_errno = errno;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
} else if (fstatat(sp->fts_cwd_fd, p->fts_accpath, sbp,
|
||||||
|
@@ -1824,8 +1835,11 @@ err: memset(sbp, 0, sizeof(struct stat));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (S_ISDIR(sbp->st_mode)) {
|
||||||
|
- p->fts_n_dirs_remaining = (sbp->st_nlink
|
||||||
|
- - (ISSET(FTS_SEEDOT) ? 0 : 2));
|
||||||
|
+ p->fts_n_dirs_remaining
|
||||||
|
+ = ((sbp->st_nlink < MIN_DIR_NLINK
|
||||||
|
+ || p->fts_level <= FTS_ROOTLEVEL)
|
||||||
|
+ ? -1
|
||||||
|
+ : sbp->st_nlink - (ISSET (FTS_SEEDOT) ? 0 : MIN_DIR_NLINK));
|
||||||
|
if (ISDOT(p->fts_name)) {
|
||||||
|
/* Command-line "." and ".." are real directories. */
|
||||||
|
return (p->fts_level == FTS_ROOTLEVEL ? FTS_D : FTS_DOT);
|
||||||
|
@@ -1914,17 +1928,7 @@ fts_alloc (FTS *sp, const char *name, register size_t namelen)
|
||||||
|
* The file name is a variable length array. Allocate the FTSENT
|
||||||
|
* structure and the file name in one chunk.
|
||||||
|
*/
|
||||||
|
- len = offsetof(FTSENT, fts_name) + namelen + 1;
|
||||||
|
- /* Align the allocation size so that it works for FTSENT,
|
||||||
|
- so that trailing padding may be referenced by direct access
|
||||||
|
- to the flexible array members, without triggering undefined behavior
|
||||||
|
- by accessing bytes beyond the heap allocation. This implicit access
|
||||||
|
- was seen for example with ISDOT() and GCC 5.1.1 at -O2.
|
||||||
|
- Do not use alignof (FTSENT) here, since C11 prohibits
|
||||||
|
- taking the alignment of a structure containing a flexible
|
||||||
|
- array member. */
|
||||||
|
- len += alignof (max_align_t) - 1;
|
||||||
|
- len &= ~ (alignof (max_align_t) - 1);
|
||||||
|
+ len = FLEXSIZEOF(FTSENT, fts_name, namelen + 1);
|
||||||
|
if ((p = malloc(len)) == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
|
diff --git a/gl/lib/fts_.h b/gl/lib/fts_.h
|
||||||
|
index b9a3f12..70cc9e3 100644
|
||||||
|
--- a/gl/lib/fts_.h
|
||||||
|
+++ b/gl/lib/fts_.h
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
/* Traverse a file hierarchy.
|
||||||
|
|
||||||
|
- Copyright (C) 2004-2015 Free Software Foundation, Inc.
|
||||||
|
+ Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -13,7 +13,7 @@
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1989, 1993
|
||||||
|
@@ -220,7 +220,11 @@ typedef struct _ftsent {
|
||||||
|
ptrdiff_t fts_level; /* depth (-1 to N) */
|
||||||
|
|
||||||
|
size_t fts_namelen; /* strlen(fts_name) */
|
||||||
|
- nlink_t fts_n_dirs_remaining; /* count down from st_nlink */
|
||||||
|
+
|
||||||
|
+ /* If not (nlink_t) -1, an upper bound on the number of
|
||||||
|
+ remaining subdirectories of interest. If this becomes
|
||||||
|
+ zero, some work can be avoided. */
|
||||||
|
+ nlink_t fts_n_dirs_remaining;
|
||||||
|
|
||||||
|
# define FTS_D 1 /* preorder directory */
|
||||||
|
# define FTS_DC 2 /* directory that causes cycles */
|
||||||
|
--
|
||||||
|
2.13.6
|
||||||
|
|
||||||
|
|
||||||
|
From ea88dd373c60feab541fe037369805f326dc3494 Mon Sep 17 00:00:00 2001
|
||||||
|
From: rpm-build <rpm-build>
|
||||||
|
Date: Mon, 12 Feb 2018 18:58:30 +0100
|
||||||
|
Subject: [PATCH 2/4] fts: remove dependency on gnulib's fleximember.h
|
||||||
|
|
||||||
|
... by reverting upstream commit edb9d82948cb23f67a19e1b435047a0570225df3
|
||||||
|
---
|
||||||
|
gl/lib/fts.c | 13 +++++++++++--
|
||||||
|
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
|
||||||
|
index bfa73e3..c37ebe2 100644
|
||||||
|
--- a/gl/lib/fts.c
|
||||||
|
+++ b/gl/lib/fts.c
|
||||||
|
@@ -71,7 +71,6 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
|
||||||
|
|
||||||
|
#if ! _LIBC
|
||||||
|
# include "fcntl--.h"
|
||||||
|
-# include "flexmember.h"
|
||||||
|
# include "openat.h"
|
||||||
|
# include "same-inode.h"
|
||||||
|
#endif
|
||||||
|
@@ -1928,7 +1927,17 @@ fts_alloc (FTS *sp, const char *name, register size_t namelen)
|
||||||
|
* The file name is a variable length array. Allocate the FTSENT
|
||||||
|
* structure and the file name in one chunk.
|
||||||
|
*/
|
||||||
|
- len = FLEXSIZEOF(FTSENT, fts_name, namelen + 1);
|
||||||
|
+ len = offsetof(FTSENT, fts_name) + namelen + 1;
|
||||||
|
+ /* Align the allocation size so that it works for FTSENT,
|
||||||
|
+ so that trailing padding may be referenced by direct access
|
||||||
|
+ to the flexible array members, without triggering undefined behavior
|
||||||
|
+ by accessing bytes beyond the heap allocation. This implicit access
|
||||||
|
+ was seen for example with ISDOT() and GCC 5.1.1 at -O2.
|
||||||
|
+ Do not use alignof (FTSENT) here, since C11 prohibits
|
||||||
|
+ taking the alignment of a structure containing a flexible
|
||||||
|
+ array member. */
|
||||||
|
+ len += alignof (max_align_t) - 1;
|
||||||
|
+ len &= ~ (alignof (max_align_t) - 1);
|
||||||
|
if ((p = malloc(len)) == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.6
|
||||||
|
|
||||||
|
|
||||||
|
From 9c1720c99bbf8998dfdaa5976bca8bdc6d93f8e7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Thu, 5 Apr 2018 08:48:01 -0700
|
||||||
|
Subject: [PATCH 3/4] fts: treat CIFS like NFS
|
||||||
|
|
||||||
|
Problem reported by Kamil Dudka in:
|
||||||
|
https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html
|
||||||
|
* lib/fts.c (S_MAGIC_CIFS): New macro.
|
||||||
|
(dirent_inode_sort_may_be_useful, leaf_optimization):
|
||||||
|
Treat CIFS like NFS.
|
||||||
|
|
||||||
|
Upstream-commit: 2e53df541a30d438859087ed4b5a396e04697b9b
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
gl/lib/fts.c | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
|
||||||
|
index c37ebe2..508ceac 100644
|
||||||
|
--- a/gl/lib/fts.c
|
||||||
|
+++ b/gl/lib/fts.c
|
||||||
|
@@ -684,6 +684,7 @@ enum leaf_optimization
|
||||||
|
|
||||||
|
/* Linux-specific constants from coreutils' src/fs.h */
|
||||||
|
# define S_MAGIC_AFS 0x5346414F
|
||||||
|
+# define S_MAGIC_CIFS 0xFF534D42
|
||||||
|
# define S_MAGIC_NFS 0x6969
|
||||||
|
# define S_MAGIC_PROC 0x9FA0
|
||||||
|
# define S_MAGIC_REISERFS 0x52654973
|
||||||
|
@@ -791,8 +792,9 @@ dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
|
||||||
|
switch (filesystem_type (p))
|
||||||
|
{
|
||||||
|
- case S_MAGIC_TMPFS:
|
||||||
|
+ case S_MAGIC_CIFS:
|
||||||
|
case S_MAGIC_NFS:
|
||||||
|
+ case S_MAGIC_TMPFS:
|
||||||
|
/* On a file system of any of these types, sorting
|
||||||
|
is unnecessary, and hence wasteful. */
|
||||||
|
return false;
|
||||||
|
@@ -826,6 +828,10 @@ leaf_optimization (FTSENT const *p)
|
||||||
|
/* Although AFS mount points are not counted in st_nlink, they
|
||||||
|
act like directories. See <https://bugs.debian.org/143111>. */
|
||||||
|
FALLTHROUGH;
|
||||||
|
+ case S_MAGIC_CIFS:
|
||||||
|
+ /* Leaf optimization causes 'find' to abort. See
|
||||||
|
+ <https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html>. */
|
||||||
|
+ FALLTHROUGH;
|
||||||
|
case S_MAGIC_NFS:
|
||||||
|
/* NFS provides usable dirent.d_type but not necessarily for all entries
|
||||||
|
of large directories, so as per <https://bugzilla.redhat.com/1252549>
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
||||||
|
|
||||||
|
From ff64329a046e76ba553c15373ed61bbed814d286 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Wed, 11 Apr 2018 12:50:35 -0700
|
||||||
|
Subject: [PATCH 4/4] fts: fix bug in find across filesystems
|
||||||
|
|
||||||
|
This fixes a bug I introduced last summer.
|
||||||
|
Problem reported by Kamil Dudka in:
|
||||||
|
https://lists.gnu.org/r/bug-gnulib/2018-04/msg00033.html
|
||||||
|
* lib/fts.c (filesystem_type, dirent_inode_sort_may_be_useful)
|
||||||
|
(leaf_optimization):
|
||||||
|
New arg for file descriptor. All callers changed.
|
||||||
|
(fts_build): Check for whether inodes should be sorted
|
||||||
|
before closing the directory.
|
||||||
|
|
||||||
|
Upstream-commit: 81b8c0d3be98f5a77403599de3d06329b3e7673e
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
gl/lib/fts.c | 55 +++++++++++++++++++++++++++++++------------------------
|
||||||
|
1 file changed, 31 insertions(+), 24 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
|
||||||
|
index 508ceac..175f12a 100644
|
||||||
|
--- a/gl/lib/fts.c
|
||||||
|
+++ b/gl/lib/fts.c
|
||||||
|
@@ -725,11 +725,12 @@ dev_type_compare (void const *x, void const *y)
|
||||||
|
return ax->st_dev == ay->st_dev;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Return the file system type of P, or 0 if not known.
|
||||||
|
+/* Return the file system type of P with file descriptor FD, or 0 if not known.
|
||||||
|
+ If FD is negative, P's file descriptor is unavailable.
|
||||||
|
Try to cache known values. */
|
||||||
|
|
||||||
|
static fsword
|
||||||
|
-filesystem_type (FTSENT const *p)
|
||||||
|
+filesystem_type (FTSENT const *p, int fd)
|
||||||
|
{
|
||||||
|
FTS *sp = p->fts_fts;
|
||||||
|
Hash_table *h = sp->fts_leaf_optimization_works_ht;
|
||||||
|
@@ -755,7 +756,7 @@ filesystem_type (FTSENT const *p)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look-up failed. Query directly and cache the result. */
|
||||||
|
- if (fstatfs (p->fts_fts->fts_cwd_fd, &fs_buf) != 0)
|
||||||
|
+ if (fd < 0 || fstatfs (fd, &fs_buf) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (h)
|
||||||
|
@@ -777,12 +778,12 @@ filesystem_type (FTSENT const *p)
|
||||||
|
return fs_buf.f_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Return false if it is easy to determine the file system type of the
|
||||||
|
- directory P, and sorting dirents on inode numbers is known not to
|
||||||
|
- improve traversal performance with that type of file system.
|
||||||
|
- Otherwise, return true. */
|
||||||
|
+/* Return true if sorting dirents on inode numbers is known to improve
|
||||||
|
+ traversal performance for the directory P with descriptor DIR_FD.
|
||||||
|
+ Return false otherwise. When in doubt, return true.
|
||||||
|
+ DIR_FD is negative if unavailable. */
|
||||||
|
static bool
|
||||||
|
-dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
+dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
|
||||||
|
{
|
||||||
|
/* Skip the sort only if we can determine efficiently
|
||||||
|
that skipping it is the right thing to do.
|
||||||
|
@@ -790,7 +791,7 @@ dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
while the cost of *not* performing it can be O(N^2) with
|
||||||
|
a very large constant. */
|
||||||
|
|
||||||
|
- switch (filesystem_type (p))
|
||||||
|
+ switch (filesystem_type (p, dir_fd))
|
||||||
|
{
|
||||||
|
case S_MAGIC_CIFS:
|
||||||
|
case S_MAGIC_NFS:
|
||||||
|
@@ -804,16 +805,17 @@ dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Given an FTS entry P for a directory D,
|
||||||
|
+/* Given an FTS entry P for a directory with descriptor DIR_FD,
|
||||||
|
return true if it is both useful and valid to apply leaf optimization.
|
||||||
|
The optimization is useful only for file systems that lack usable
|
||||||
|
dirent.d_type info. The optimization is valid if an st_nlink value
|
||||||
|
of at least MIN_DIR_NLINK is an upper bound on the number of
|
||||||
|
- subdirectories of D, counting "." and ".." as subdirectories. */
|
||||||
|
+ subdirectories of D, counting "." and ".." as subdirectories.
|
||||||
|
+ DIR_FD is negative if unavailable. */
|
||||||
|
static enum leaf_optimization
|
||||||
|
-leaf_optimization (FTSENT const *p)
|
||||||
|
+leaf_optimization (FTSENT const *p, int dir_fd)
|
||||||
|
{
|
||||||
|
- switch (filesystem_type (p))
|
||||||
|
+ switch (filesystem_type (p, dir_fd))
|
||||||
|
{
|
||||||
|
/* List here the file system types that may lack usable dirent.d_type
|
||||||
|
info, yet for which the optimization does apply. */
|
||||||
|
@@ -850,12 +852,13 @@ leaf_optimization (FTSENT const *p)
|
||||||
|
|
||||||
|
#else
|
||||||
|
static bool
|
||||||
|
-dirent_inode_sort_may_be_useful (FTSENT const *p _GL_UNUSED)
|
||||||
|
+dirent_inode_sort_may_be_useful (FTSENT const *p _GL_UNUSED,
|
||||||
|
+ int dir_fd _GL_UNUSED)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
static enum leaf_optimization
|
||||||
|
-leaf_optimization (FTSENT const *p _GL_UNUSED)
|
||||||
|
+leaf_optimization (FTSENT const *p _GL_UNUSED, int dir_fd _GL_UNUSED)
|
||||||
|
{
|
||||||
|
return NO_LEAF_OPTIMIZATION;
|
||||||
|
}
|
||||||
|
@@ -1049,7 +1052,7 @@ check_for_dir:
|
||||||
|
if (parent->fts_n_dirs_remaining == 0
|
||||||
|
&& ISSET(FTS_NOSTAT)
|
||||||
|
&& ISSET(FTS_PHYSICAL)
|
||||||
|
- && (leaf_optimization (parent)
|
||||||
|
+ && (leaf_optimization (parent, sp->fts_cwd_fd)
|
||||||
|
== NOSTAT_LEAF_OPTIMIZATION))
|
||||||
|
{
|
||||||
|
/* nothing more needed */
|
||||||
|
@@ -1334,6 +1337,7 @@ fts_build (register FTS *sp, int type)
|
||||||
|
int dir_fd;
|
||||||
|
FTSENT *cur = sp->fts_cur;
|
||||||
|
bool continue_readdir = !!cur->fts_dirp;
|
||||||
|
+ bool sort_by_inode = false;
|
||||||
|
size_t max_entries;
|
||||||
|
|
||||||
|
/* When cur->fts_dirp is non-NULL, that means we should
|
||||||
|
@@ -1427,7 +1431,7 @@ fts_build (register FTS *sp, int type)
|
||||||
|
&& ! (ISSET (FTS_NOSTAT) && ISSET (FTS_PHYSICAL)
|
||||||
|
&& ! ISSET (FTS_SEEDOT)
|
||||||
|
&& cur->fts_statp->st_nlink == MIN_DIR_NLINK
|
||||||
|
- && (leaf_optimization (cur)
|
||||||
|
+ && (leaf_optimization (cur, dir_fd)
|
||||||
|
!= NO_LEAF_OPTIMIZATION)));
|
||||||
|
if (descend || type == BREAD)
|
||||||
|
{
|
||||||
|
@@ -1588,6 +1592,15 @@ mem1: saved_errno = errno;
|
||||||
|
tail->fts_link = p;
|
||||||
|
tail = p;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /* If there are many entries, no sorting function has been
|
||||||
|
+ specified, and this file system is of a type that may be
|
||||||
|
+ slow with a large number of entries, arrange to sort the
|
||||||
|
+ directory entries on increasing inode numbers. */
|
||||||
|
+ if (nitems == _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
|
||||||
|
+ && !sp->fts_compar)
|
||||||
|
+ sort_by_inode = dirent_inode_sort_may_be_useful (cur, dir_fd);
|
||||||
|
+
|
||||||
|
++nitems;
|
||||||
|
if (max_entries <= nitems) {
|
||||||
|
/* When there are too many dir entries, leave
|
||||||
|
@@ -1645,13 +1658,7 @@ mem1: saved_errno = errno;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* If there are many entries, no sorting function has been specified,
|
||||||
|
- and this file system is of a type that may be slow with a large
|
||||||
|
- number of entries, then sort the directory entries on increasing
|
||||||
|
- inode numbers. */
|
||||||
|
- if (nitems > _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
|
||||||
|
- && !sp->fts_compar
|
||||||
|
- && dirent_inode_sort_may_be_useful (cur)) {
|
||||||
|
+ if (sort_by_inode) {
|
||||||
|
sp->fts_compar = fts_compare_ino;
|
||||||
|
head = fts_sort (sp, head, nitems);
|
||||||
|
sp->fts_compar = NULL;
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
142
findutils-4.6.0-gnulib-fflush.patch
Normal file
142
findutils-4.6.0-gnulib-fflush.patch
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
From 80cdfba079627e15129a926a133825b961d41e36 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Mon, 5 Mar 2018 10:56:29 -0800
|
||||||
|
Subject: [PATCH] fflush: adjust to glibc 2.28 libio.h removal
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Problem reported by Daniel P. Berrangé in:
|
||||||
|
https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
|
||||||
|
* lib/fflush.c (clear_ungetc_buffer_preserving_position)
|
||||||
|
(disable_seek_optimization, rpl_fflush):
|
||||||
|
* lib/fpurge.c (fpurge):
|
||||||
|
* lib/freadahead.c (freadahead):
|
||||||
|
* lib/freading.c (freading):
|
||||||
|
* lib/fseeko.c (fseeko):
|
||||||
|
* lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
|
||||||
|
Define if not already defined.
|
||||||
|
|
||||||
|
Upstream-commit: 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
gl/lib/fflush.c | 6 +++---
|
||||||
|
gl/lib/fpurge.c | 2 +-
|
||||||
|
gl/lib/freadahead.c | 2 +-
|
||||||
|
gl/lib/freading.c | 2 +-
|
||||||
|
gl/lib/fseeko.c | 4 ++--
|
||||||
|
gl/lib/stdio-impl.h | 6 ++++++
|
||||||
|
6 files changed, 14 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gl/lib/fflush.c b/gl/lib/fflush.c
|
||||||
|
index 5ae3e41..7a82470 100644
|
||||||
|
--- a/gl/lib/fflush.c
|
||||||
|
+++ b/gl/lib/fflush.c
|
||||||
|
@@ -33,7 +33,7 @@
|
||||||
|
#undef fflush
|
||||||
|
|
||||||
|
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
|
||||||
|
/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
|
||||||
|
static void
|
||||||
|
@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
|
||||||
|
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
|
||||||
|
|
||||||
|
# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
|
||||||
|
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
|
||||||
|
@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
|
||||||
|
if (stream == NULL || ! freading (stream))
|
||||||
|
return fflush (stream);
|
||||||
|
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
|
||||||
|
clear_ungetc_buffer_preserving_position (stream);
|
||||||
|
|
||||||
|
diff --git a/gl/lib/fpurge.c b/gl/lib/fpurge.c
|
||||||
|
index f313b22..ecdf82d 100644
|
||||||
|
--- a/gl/lib/fpurge.c
|
||||||
|
+++ b/gl/lib/fpurge.c
|
||||||
|
@@ -62,7 +62,7 @@ fpurge (FILE *fp)
|
||||||
|
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||||
|
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||||
|
fast macros. */
|
||||||
|
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
fp->_IO_read_end = fp->_IO_read_ptr;
|
||||||
|
fp->_IO_write_ptr = fp->_IO_write_base;
|
||||||
|
/* Avoid memory leak when there is an active ungetc buffer. */
|
||||||
|
diff --git a/gl/lib/freadahead.c b/gl/lib/freadahead.c
|
||||||
|
index 094daab..3f8101e 100644
|
||||||
|
--- a/gl/lib/freadahead.c
|
||||||
|
+++ b/gl/lib/freadahead.c
|
||||||
|
@@ -25,7 +25,7 @@
|
||||||
|
size_t
|
||||||
|
freadahead (FILE *fp)
|
||||||
|
{
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||||
|
return 0;
|
||||||
|
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||||
|
diff --git a/gl/lib/freading.c b/gl/lib/freading.c
|
||||||
|
index 0512b19..8c48fe4 100644
|
||||||
|
--- a/gl/lib/freading.c
|
||||||
|
+++ b/gl/lib/freading.c
|
||||||
|
@@ -31,7 +31,7 @@ freading (FILE *fp)
|
||||||
|
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||||
|
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||||
|
fast macros. */
|
||||||
|
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
return ((fp->_flags & _IO_NO_WRITES) != 0
|
||||||
|
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
|
||||||
|
&& fp->_IO_read_base != NULL));
|
||||||
|
diff --git a/gl/lib/fseeko.c b/gl/lib/fseeko.c
|
||||||
|
index 1c65d2a..9026408 100644
|
||||||
|
--- a/gl/lib/fseeko.c
|
||||||
|
+++ b/gl/lib/fseeko.c
|
||||||
|
@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These tests are based on fpurge.c. */
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||||
|
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||||
|
&& fp->_IO_save_base == NULL)
|
||||||
|
@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
fp->_flags &= ~_IO_EOF_SEEN;
|
||||||
|
fp->_offset = pos;
|
||||||
|
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||||
|
diff --git a/gl/lib/stdio-impl.h b/gl/lib/stdio-impl.h
|
||||||
|
index 502d891..ea38ee2 100644
|
||||||
|
--- a/gl/lib/stdio-impl.h
|
||||||
|
+++ b/gl/lib/stdio-impl.h
|
||||||
|
@@ -18,6 +18,12 @@
|
||||||
|
the same implementation of stdio extension API, except that some fields
|
||||||
|
have different naming conventions, or their access requires some casts. */
|
||||||
|
|
||||||
|
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||||
|
+ problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||||
|
+ internals. */
|
||||||
|
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||||
|
+# define _IO_IN_BACKUP 0x100
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* BSD stdio derived implementations. */
|
||||||
|
|
||||||
|
--
|
||||||
|
2.16.2
|
||||||
|
|
80
findutils-4.6.0-gnulib-makedev.patch
Normal file
80
findutils-4.6.0-gnulib-makedev.patch
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
From 80628047a6cc83f82e0c410a82b8f7facd9d50f2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric Blake <eblake@redhat.com>
|
||||||
|
Date: Wed, 14 Sep 2016 19:21:42 -0500
|
||||||
|
Subject: [PATCH] mountlist: include sysmacros.h for glibc
|
||||||
|
|
||||||
|
On Fedora rawhide (glibc 2.25), './gnulib-tool --test mountlist'
|
||||||
|
reports:
|
||||||
|
../../gllib/mountlist.c: In function 'read_file_system_list':
|
||||||
|
../../gllib/mountlist.c:534:13: warning: '__makedev_from_sys_types' is deprecated:
|
||||||
|
In the GNU C Library, `makedev' is defined by <sys/sysmacros.h>.
|
||||||
|
For historical compatibility, it is currently defined by
|
||||||
|
<sys/types.h> as well, but we plan to remove this soon.
|
||||||
|
To use `makedev', include <sys/sysmacros.h> directly.
|
||||||
|
If you did not intend to use a system-defined macro `makedev',
|
||||||
|
you should #undef it after including <sys/types.h>.
|
||||||
|
[-Wdeprecated-declarations]
|
||||||
|
me->me_dev = makedev (devmaj, devmin);
|
||||||
|
^~
|
||||||
|
In file included from /usr/include/features.h:397:0,
|
||||||
|
from /usr/include/sys/types.h:25,
|
||||||
|
from ./sys/types.h:28,
|
||||||
|
from ../../gllib/mountlist.h:23,
|
||||||
|
from ../../gllib/mountlist.c:20:
|
||||||
|
/usr/include/sys/sysmacros.h:89:1: note: declared here
|
||||||
|
__SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_FST_IMPL_TEMPL)
|
||||||
|
^
|
||||||
|
|
||||||
|
Fix it by including the right headers. We also need a fix to
|
||||||
|
autoconf's AC_HEADER_MAJOR, but that's a separate patch.
|
||||||
|
|
||||||
|
* m4/mountlist.m4 (gl_PREREQ_MOUTLIST_EXTRA): Include
|
||||||
|
AC_HEADER_MAJOR.
|
||||||
|
* lib/mountlist.c (includes): Use correct headers.
|
||||||
|
|
||||||
|
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||||
|
|
||||||
|
Upstream-commit: 4da63c5881f60f71999a943612da9112232b9161
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
gl/lib/mountlist.c | 6 ++++++
|
||||||
|
gl/m4/mountlist.m4 | 3 ++-
|
||||||
|
2 files changed, 8 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gl/lib/mountlist.c b/gl/lib/mountlist.c
|
||||||
|
index c3d2852..0b6f92e 100644
|
||||||
|
--- a/gl/lib/mountlist.c
|
||||||
|
+++ b/gl/lib/mountlist.c
|
||||||
|
@@ -37,6 +37,12 @@
|
||||||
|
# include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if MAJOR_IN_MKDEV
|
||||||
|
+# include <sys/mkdev.h>
|
||||||
|
+#elif MAJOR_IN_SYSMACROS
|
||||||
|
+# include <sys/sysmacros.h>
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */
|
||||||
|
# if HAVE_SYS_UCRED_H
|
||||||
|
# include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
|
||||||
|
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4
|
||||||
|
index ec58dc8..82b2dcb 100644
|
||||||
|
--- a/gl/m4/mountlist.m4
|
||||||
|
+++ b/gl/m4/mountlist.m4
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-# serial 11
|
||||||
|
+# serial 12
|
||||||
|
dnl Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
@@ -15,5 +15,6 @@ AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
|
||||||
|
[
|
||||||
|
dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h.
|
||||||
|
AC_CHECK_HEADERS([sys/mntent.h])
|
||||||
|
+ AC_HEADER_MAJOR()dnl for use of makedev ()
|
||||||
|
gl_FSTYPENAME
|
||||||
|
])
|
||||||
|
--
|
||||||
|
2.16.2
|
||||||
|
|
80
findutils-4.6.0-improve-printf-Ak-description.patch
Normal file
80
findutils-4.6.0-improve-printf-Ak-description.patch
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
From efa455493063270406f3c206d62032a475e52c47 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
Date: Tue, 6 Oct 2020 17:10:08 +0200
|
||||||
|
Subject: [PATCH] doc: avoid misunderstanding of '-printf %Ak' description
|
||||||
|
|
||||||
|
* find/find.1 (-printf): Make it clear that the list of conversion
|
||||||
|
specification characters of '%Ak' is incomplete; refer to the
|
||||||
|
strftime() documentation. While at it, document the F conversion
|
||||||
|
character which yields 'yyyy-mm-dd'.
|
||||||
|
* doc/find.texi (Time Formats): Likewise.
|
||||||
|
|
||||||
|
Suggested in https://bugzilla.redhat.com/1882695
|
||||||
|
|
||||||
|
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
|
||||||
|
---
|
||||||
|
doc/find.texi | 11 +++++++----
|
||||||
|
find/find.1 | 9 ++++++---
|
||||||
|
2 files changed, 13 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/doc/find.texi b/doc/find.texi
|
||||||
|
index ce63ca52..0d7c8ae8 100644
|
||||||
|
--- a/doc/find.texi
|
||||||
|
+++ b/doc/find.texi
|
||||||
|
@@ -2063,10 +2063,11 @@ behaviour, because other directives may be added in the future.
|
||||||
|
@node Time Formats
|
||||||
|
@subsection Time Formats
|
||||||
|
|
||||||
|
-Below are the formats for the directives @samp{%A}, @samp{%C}, and
|
||||||
|
-@samp{%T}, which print the file's timestamps. Some of these formats
|
||||||
|
-might not be available on all systems, due to differences in the C
|
||||||
|
-@code{strftime} function between systems.
|
||||||
|
+Below is an incomplete list of formats for the directives @samp{%A}, @samp{%C},
|
||||||
|
+and @samp{%T}, which print the file's timestamps.
|
||||||
|
+Please refer to the documentation of @code{strftime} for the full list.
|
||||||
|
+Some of these formats might not be available on all systems, due to differences
|
||||||
|
+in the implementation of the C @code{strftime} function.
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Time Components::
|
||||||
|
@@ -2162,6 +2163,8 @@ locale's date and time in ctime format (Sat Nov 04 12:02:33 EST
|
||||||
|
seconds field.
|
||||||
|
@item D
|
||||||
|
date (mm/dd/yy)
|
||||||
|
+@item F
|
||||||
|
+date (yyyy-mm-dd)
|
||||||
|
@item x
|
||||||
|
locale's date representation (mm/dd/yy)
|
||||||
|
@item +
|
||||||
|
diff --git a/find/find.1 b/find/find.1
|
||||||
|
index ee7c6842..27ec62cd 100644
|
||||||
|
--- a/find/find.1
|
||||||
|
+++ b/find/find.1
|
||||||
|
@@ -1420,10 +1420,11 @@
|
||||||
|
File's last access time in the format returned by the C `ctime' function.
|
||||||
|
.IP %A\fIk\fP
|
||||||
|
File's last access time in the format specified by \fIk\fR, which is
|
||||||
|
-either `@' or a directive for the C `strftime' function. The possible
|
||||||
|
-values for \fIk\fR are listed below; some of them might not be
|
||||||
|
-available on all systems, due to differences in `strftime' between
|
||||||
|
-systems.
|
||||||
|
+either `@' or a directive for the C `strftime' function. The following
|
||||||
|
+shows an incomplete list of possible values for \fIk\fR.
|
||||||
|
+Please refer to the documentation of `strftime' for the full list.
|
||||||
|
+Some of the conversion specification characters might not be available on all systems,
|
||||||
|
+due to differences in the implementation of the `strftime' library function.
|
||||||
|
.RS
|
||||||
|
.IP @
|
||||||
|
seconds since Jan.\& 1, 1970, 00:00 GMT, with fractional part.
|
||||||
|
@@ -1476,6 +1477,8 @@ in the seconds field.
|
||||||
|
day of month (01..31)
|
||||||
|
.IP D
|
||||||
|
date (mm/dd/yy)
|
||||||
|
+.IP F
|
||||||
|
+date (yyyy-mm-dd)
|
||||||
|
.IP h
|
||||||
|
same as b
|
||||||
|
.IP j
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
195
findutils-4.6.0-internal-noop.patch
Normal file
195
findutils-4.6.0-internal-noop.patch
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
From d844b7bbf3952998a906f21ba432aa62a3b9c7c6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||||
|
Date: Tue, 14 Jun 2016 20:49:42 +0200
|
||||||
|
Subject: [PATCH] Fix bug #48180: find: avoid segfault for internal '-noop'
|
||||||
|
option
|
||||||
|
|
||||||
|
The pseudo-option '-noop' was never meant to be exposed to the user
|
||||||
|
interface. If specified by the user, find(1) segfaulted.
|
||||||
|
Bug introduced in commit FINDUTILS_4_3_0-1-12-g6b8a4db.
|
||||||
|
|
||||||
|
* find/parser.c (struct parser_table): Rename the parser_name element of
|
||||||
|
the ARG_NOOP entry from 'noop' to '--noop', thus indicating its pure
|
||||||
|
internal character.
|
||||||
|
(found_parser): Return NULL when the user has passed the '---noop' option;
|
||||||
|
the caller does the error handling.
|
||||||
|
* find/testsuite/sv-48180-refuse-noop.sh: Add test.
|
||||||
|
* find/testsuite/Makefile.am (test_shell_progs): Reference the test.
|
||||||
|
* NEWS (Bug fixes): Document the fix.
|
||||||
|
|
||||||
|
Reported by Tavian Barnes <tavianator@tavianator.com> in
|
||||||
|
https://savannah.gnu.org/bugs/?48180
|
||||||
|
|
||||||
|
Upstream-commit: 595060f28eb5f658fa8d98970959c617fab0f078
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
find/parser.c | 6 +-
|
||||||
|
find/testsuite/Makefile.am | 3 +-
|
||||||
|
find/testsuite/sv-48180-refuse-noop.sh | 117 +++++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 124 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 find/testsuite/sv-48180-refuse-noop.sh
|
||||||
|
|
||||||
|
diff --git a/find/parser.c b/find/parser.c
|
||||||
|
index 2d45349..697b2a2 100644
|
||||||
|
--- a/find/parser.c
|
||||||
|
+++ b/find/parser.c
|
||||||
|
@@ -321,7 +321,8 @@ static struct parser_table const parse_table[] =
|
||||||
|
*/
|
||||||
|
{ARG_TEST, "false", parse_false, pred_false}, /* GNU */
|
||||||
|
{ARG_TEST, "true", parse_true, pred_true }, /* GNU */
|
||||||
|
- {ARG_NOOP, "noop", NULL, pred_true }, /* GNU, internal use only */
|
||||||
|
+ /* Internal pseudo-option, therefore 3 minus: ---noop. */
|
||||||
|
+ {ARG_NOOP, "--noop", NULL, pred_true }, /* GNU, internal use only */
|
||||||
|
|
||||||
|
/* Various other cases that don't fit neatly into our macro scheme. */
|
||||||
|
{ARG_TEST, "help", parse_help, NULL}, /* GNU */
|
||||||
|
@@ -596,6 +597,9 @@ found_parser (const char *original_arg, const struct parser_table *entry)
|
||||||
|
*/
|
||||||
|
if (entry->type != ARG_POSITIONAL_OPTION)
|
||||||
|
{
|
||||||
|
+ if (entry->type == ARG_NOOP)
|
||||||
|
+ return NULL; /* internal use only, trap -noop here. */
|
||||||
|
+
|
||||||
|
/* Something other than -follow/-daystart.
|
||||||
|
* If this is an option, check if it followed
|
||||||
|
* a non-option and if so, issue a warning.
|
||||||
|
diff --git a/find/testsuite/Makefile.am b/find/testsuite/Makefile.am
|
||||||
|
index ab5dbe8..1371c70 100644
|
||||||
|
--- a/find/testsuite/Makefile.am
|
||||||
|
+++ b/find/testsuite/Makefile.am
|
||||||
|
@@ -259,7 +259,8 @@ test_escape_c.sh \
|
||||||
|
test_inode.sh \
|
||||||
|
sv-34079.sh \
|
||||||
|
sv-34976-execdir-fd-leak.sh \
|
||||||
|
-sv-48030-exec-plus-bug.sh
|
||||||
|
+sv-48030-exec-plus-bug.sh \
|
||||||
|
+sv-48180-refuse-noop.sh
|
||||||
|
|
||||||
|
EXTRA_DIST = $(EXTRA_DIST_EXP) $(EXTRA_DIST_XO) $(EXTRA_DIST_GOLDEN) \
|
||||||
|
$(test_shell_progs) binary_locations.sh checklists.py
|
||||||
|
diff --git a/find/testsuite/sv-48180-refuse-noop.sh b/find/testsuite/sv-48180-refuse-noop.sh
|
||||||
|
new file mode 100755
|
||||||
|
index 0000000..974f0f0
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/find/testsuite/sv-48180-refuse-noop.sh
|
||||||
|
@@ -0,0 +1,117 @@
|
||||||
|
+#! /bin/sh
|
||||||
|
+# Copyright (C) 2016 Free Software Foundation, Inc.
|
||||||
|
+#
|
||||||
|
+# This program is free software: you can redistribute it and/or modify
|
||||||
|
+# it under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+#
|
||||||
|
+# This program is distributed in the hope that it will be useful,
|
||||||
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+# GNU General Public License for more details.
|
||||||
|
+#
|
||||||
|
+# You should have received a copy of the GNU General Public License
|
||||||
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+# This test verifies that find refuses the internal -noop, ---noop option.
|
||||||
|
+# Between findutils-4.3.1 and 4.6, find dumped core ($? = 139).
|
||||||
|
+
|
||||||
|
+testname="$(basename $0)"
|
||||||
|
+
|
||||||
|
+. "${srcdir}"/binary_locations.sh
|
||||||
|
+
|
||||||
|
+die() {
|
||||||
|
+ echo "$@" >&2
|
||||||
|
+ exit 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# This is used to simplify checking of the return value
|
||||||
|
+# which is useful when ensuring a command fails as desired.
|
||||||
|
+# I.e., just doing `command ... &&fail=1` will not catch
|
||||||
|
+# a segfault in command for example. With this helper you
|
||||||
|
+# instead check an explicit exit code like
|
||||||
|
+# returns_ 1 command ... || fail
|
||||||
|
+returns_ () {
|
||||||
|
+ # Disable tracing so it doesn't interfere with stderr of the wrapped command
|
||||||
|
+ { set +x; } 2>/dev/null
|
||||||
|
+
|
||||||
|
+ local exp_exit="$1"
|
||||||
|
+ shift
|
||||||
|
+ "$@"
|
||||||
|
+ test $? -eq $exp_exit && ret_=0 || ret_=1
|
||||||
|
+
|
||||||
|
+ set -x
|
||||||
|
+ { return $ret_; } 2>/dev/null
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Define the nicest compare available (borrowed from gnulib).
|
||||||
|
+if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" < /dev/null` \
|
||||||
|
+ && diff -u Makefile "$0" 2>/dev/null | grep '^[+]#!' >/dev/null; then
|
||||||
|
+ # diff accepts the -u option and does not (like AIX 7 'diff') produce an
|
||||||
|
+ # extra space on column 1 of every content line.
|
||||||
|
+ if test -z "$diff_out_"; then
|
||||||
|
+ compare () { diff -u "$@"; }
|
||||||
|
+ else
|
||||||
|
+ compare ()
|
||||||
|
+ {
|
||||||
|
+ if diff -u "$@" > diff.out; then
|
||||||
|
+ # No differences were found, but Solaris 'diff' produces output
|
||||||
|
+ # "No differences encountered". Hide this output.
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ true
|
||||||
|
+ else
|
||||||
|
+ cat diff.out
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ false
|
||||||
|
+ fi
|
||||||
|
+ }
|
||||||
|
+ fi
|
||||||
|
+elif diff_out_=`exec 2>/dev/null; diff -c "$0" "$0" < /dev/null`; then
|
||||||
|
+ if test -z "$diff_out_"; then
|
||||||
|
+ compare () { diff -c "$@"; }
|
||||||
|
+ else
|
||||||
|
+ compare ()
|
||||||
|
+ {
|
||||||
|
+ if diff -c "$@" > diff.out; then
|
||||||
|
+ # No differences were found, but AIX and HP-UX 'diff' produce output
|
||||||
|
+ # "No differences encountered" or "There are no differences between the
|
||||||
|
+ # files.". Hide this output.
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ true
|
||||||
|
+ else
|
||||||
|
+ cat diff.out
|
||||||
|
+ rm -f diff.out
|
||||||
|
+ false
|
||||||
|
+ fi
|
||||||
|
+ }
|
||||||
|
+ fi
|
||||||
|
+elif cmp -s /dev/null /dev/null 2>/dev/null; then
|
||||||
|
+ compare () { cmp -s "$@"; }
|
||||||
|
+else
|
||||||
|
+ compare () { cmp "$@"; }
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+set -x
|
||||||
|
+tmpdir="$(mktemp -d)" \
|
||||||
|
+ && cd "$tmpdir" \
|
||||||
|
+ || die "FAIL: failed to set up the test in ${tmpdir}"
|
||||||
|
+
|
||||||
|
+fail=0
|
||||||
|
+# Exercise both the previous name of the pseudo-option '-noop',
|
||||||
|
+# and the now renamed '---noop' option for both find executables.
|
||||||
|
+for exe in "${ftsfind}" "${oldfind}"; do
|
||||||
|
+ for opt in 'noop' '--noop'; do
|
||||||
|
+ out="${exe}${opt}.out"
|
||||||
|
+ err="${exe}${opt}.err"
|
||||||
|
+ returns_ 1 "$exe" "-${opt}" >"$out" 2> "$err" || fail=1
|
||||||
|
+ compare /dev/null "$out" || fail=1
|
||||||
|
+ grep "find: unknown predicate .-${opt}." "$err" \
|
||||||
|
+ || { cat "$err"; fail=1; }
|
||||||
|
+ done
|
||||||
|
+done
|
||||||
|
+
|
||||||
|
+cd ..
|
||||||
|
+rm -rf "$tmpdir" || exit 1
|
||||||
|
+exit $fail
|
||||||
|
--
|
||||||
|
2.5.5
|
||||||
|
|
@ -1,46 +1,7 @@
|
|||||||
From 547e7145f335dc07144f35eaacc520475068852e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kamil Dudka <kdudka@redhat.com>
|
|
||||||
Date: Fri, 30 Aug 2019 10:22:22 +0200
|
|
||||||
Subject: [PATCH 1/3] Revert "fts: cleanup after FTS_NOATIME removal"
|
|
||||||
|
|
||||||
This reverts commit dce8759f0f0236a860a3e68b63c5e99cc6f168f9.
|
|
||||||
---
|
|
||||||
gl/lib/fts_.h | 10 ++++++----
|
|
||||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/gl/lib/fts_.h b/gl/lib/fts_.h
|
|
||||||
index fb5558f..0122262 100644
|
|
||||||
--- a/gl/lib/fts_.h
|
|
||||||
+++ b/gl/lib/fts_.h
|
|
||||||
@@ -149,14 +149,16 @@ typedef struct {
|
|
||||||
dirent.d_type data. */
|
|
||||||
# define FTS_DEFER_STAT 0x0400
|
|
||||||
|
|
||||||
+/* 0x0800 unused, was non-working FTS_NOATIME */
|
|
||||||
+
|
|
||||||
/* Use this flag to disable stripping of trailing slashes
|
|
||||||
from input path names during fts_open initialization. */
|
|
||||||
-# define FTS_VERBATIM 0x0800
|
|
||||||
+# define FTS_VERBATIM 0x1000
|
|
||||||
|
|
||||||
-# define FTS_OPTIONMASK 0x0fff /* valid user option mask */
|
|
||||||
+# define FTS_OPTIONMASK 0x1fff /* valid user option mask */
|
|
||||||
|
|
||||||
-# define FTS_NAMEONLY 0x1000 /* (private) child names only */
|
|
||||||
-# define FTS_STOP 0x2000 /* (private) unrecoverable error */
|
|
||||||
+# define FTS_NAMEONLY 0x2000 /* (private) child names only */
|
|
||||||
+# define FTS_STOP 0x4000 /* (private) unrecoverable error */
|
|
||||||
int fts_options; /* fts_open options, global flags */
|
|
||||||
|
|
||||||
/* Map a directory's device number to a boolean. The boolean is
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
||||||
|
|
||||||
From 1328926a705fdb4728c1f255dd368de928736d39 Mon Sep 17 00:00:00 2001
|
From 1328926a705fdb4728c1f255dd368de928736d39 Mon Sep 17 00:00:00 2001
|
||||||
From: Kamil Dudka <kdudka@redhat.com>
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
Date: Fri, 25 Sep 2015 16:09:39 +0200
|
Date: Fri, 25 Sep 2015 16:09:39 +0200
|
||||||
Subject: [PATCH 2/3] fts: introduce the FTS_NOLEAF flag
|
Subject: [PATCH 1/2] fts: introduce the FTS_NOLEAF flag
|
||||||
|
|
||||||
The flag is needed to implement the -noleaf option of find.
|
The flag is needed to implement the -noleaf option of find.
|
||||||
* lib/fts.c (link_count_optimize_ok): Implement the FTS_NOLEAF flag.
|
* lib/fts.c (link_count_optimize_ok): Implement the FTS_NOLEAF flag.
|
||||||
@ -54,7 +15,7 @@ diff --git a/gl/lib/fts.c b/gl/lib/fts.c
|
|||||||
index d2d404f..808466f 100644
|
index d2d404f..808466f 100644
|
||||||
--- a/gl/lib/fts.c
|
--- a/gl/lib/fts.c
|
||||||
+++ b/gl/lib/fts.c
|
+++ b/gl/lib/fts.c
|
||||||
@@ -713,6 +713,10 @@ filesystem_type (FTSENT const *p, int fd)
|
@@ -736,6 +736,10 @@ filesystem_type (FTSENT const *p)
|
||||||
struct dev_type *ent;
|
struct dev_type *ent;
|
||||||
struct statfs fs_buf;
|
struct statfs fs_buf;
|
||||||
|
|
||||||
@ -96,7 +57,7 @@ index 63d4b74..f1d519b 100644
|
|||||||
From c186934e6e37ddadf7511abb9b1045192757618e Mon Sep 17 00:00:00 2001
|
From c186934e6e37ddadf7511abb9b1045192757618e Mon Sep 17 00:00:00 2001
|
||||||
From: Kamil Dudka <kdudka@redhat.com>
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
Date: Fri, 25 Sep 2015 19:13:15 +0200
|
Date: Fri, 25 Sep 2015 19:13:15 +0200
|
||||||
Subject: [PATCH 3/3] ftsfind: propagate the -noleaf option to FTS
|
Subject: [PATCH 2/2] ftsfind: propagate the -noleaf option to FTS
|
||||||
|
|
||||||
* find/ftsfind.c (find): Propagate the -noleaf option to FTS.
|
* find/ftsfind.c (find): Propagate the -noleaf option to FTS.
|
||||||
---
|
---
|
||||||
@ -107,7 +68,7 @@ diff --git a/find/ftsfind.c b/find/ftsfind.c
|
|||||||
index 5159470..e34b672 100644
|
index 5159470..e34b672 100644
|
||||||
--- a/find/ftsfind.c
|
--- a/find/ftsfind.c
|
||||||
+++ b/find/ftsfind.c
|
+++ b/find/ftsfind.c
|
||||||
@@ -553,6 +553,9 @@ find (char *arg)
|
@@ -559,6 +559,9 @@ find (char *arg)
|
||||||
if (options.stay_on_filesystem)
|
if (options.stay_on_filesystem)
|
||||||
ftsoptions |= FTS_XDEV;
|
ftsoptions |= FTS_XDEV;
|
||||||
|
|
||||||
|
44
findutils-4.6.0-man-exec.patch
Normal file
44
findutils-4.6.0-man-exec.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From a8ff1e964b2b8cd0b60362c76bd92795cee6b3c3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
Date: Sun, 17 Apr 2016 22:36:13 +0200
|
||||||
|
Subject: [PATCH] doc: clarify exit status handling of -exec command {} +
|
||||||
|
|
||||||
|
* find/find.1 (-exec): Explain how exit status is propagated if the
|
||||||
|
-exec command {} + syntax is used.
|
||||||
|
(-execdir): Likewise.
|
||||||
|
|
||||||
|
Reported at https://bugzilla.redhat.com/1325049
|
||||||
|
|
||||||
|
Upstream-commit: ae424b959c5e9bd23f9f686cb34653bc4cd1270e
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
find/find.1 | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/find/find.1 b/find/find.1
|
||||||
|
index a36a0bc..c4aaf17 100644
|
||||||
|
--- a/find/find.1
|
||||||
|
+++ b/find/find.1
|
||||||
|
@@ -1069,6 +1069,9 @@ command line is built in much the same way that
|
||||||
|
.B xargs
|
||||||
|
builds its command lines. Only one instance of `{}' is allowed within
|
||||||
|
the command. The command is executed in the starting directory. If
|
||||||
|
+any invocation returns a non-zero value as exit status, then
|
||||||
|
+.B find
|
||||||
|
+returns a non-zero exit status. If
|
||||||
|
.B find
|
||||||
|
encounters an error, this can sometimes cause an
|
||||||
|
immediate exit, so some pending commands may not be run
|
||||||
|
@@ -1104,6 +1107,9 @@ appropriately-named file in a directory in which you will run
|
||||||
|
The same applies to having entries in
|
||||||
|
.B $PATH
|
||||||
|
which are empty or which are not absolute directory names. If
|
||||||
|
+any invocation returns a non-zero value as exit status, then
|
||||||
|
+.B find
|
||||||
|
+returns a non-zero exit status. If
|
||||||
|
.B find
|
||||||
|
encounters an error, this can sometimes cause an
|
||||||
|
immediate exit, so some pending commands may not be run
|
||||||
|
--
|
||||||
|
2.5.5
|
||||||
|
|
35
findutils-4.6.0-mbrtowc-tests.patch
Normal file
35
findutils-4.6.0-mbrtowc-tests.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From 06a46ba755195810f2aeda01b12d1ccfe7c2dcfd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daiki Ueno <ueno@gnu.org>
|
||||||
|
Date: Mon, 28 Dec 2015 06:27:42 +0900
|
||||||
|
Subject: [PATCH] maint: fix operator precedence in mbrtowc test
|
||||||
|
|
||||||
|
This is a fix for test breakage introduced by commit 45228d96; the
|
||||||
|
equality expression must be parenthesized when negated with '!',
|
||||||
|
otherwise we always get:
|
||||||
|
|
||||||
|
test-mbrtowc.c:49: assertion 'ret == (size_t)(-2)' failed
|
||||||
|
|
||||||
|
* m4/mbrtowc.m4 (gl_MBRTOWC_EMPTY_INPUT): Negate the entire expression.
|
||||||
|
|
||||||
|
Upstream-commit: 1f63650823cebf52044df840c81062ccb52163a2
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
gl/m4/mbrtowc.m4 | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4
|
||||||
|
index deb9f06..be2e9d6 100644
|
||||||
|
--- a/gl/m4/mbrtowc.m4
|
||||||
|
+++ b/gl/m4/mbrtowc.m4
|
||||||
|
@@ -569,7 +569,7 @@ changequote([,])dnl
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
- return ! mbrtowc (&wc, "", 0, &mbs) == (size_t) -2;
|
||||||
|
+ return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2;
|
||||||
|
}]])],
|
||||||
|
[gl_cv_func_mbrtowc_empty_input=yes],
|
||||||
|
[gl_cv_func_mbrtowc_empty_input=no],
|
||||||
|
--
|
||||||
|
2.5.0
|
||||||
|
|
@ -8,13 +8,13 @@ prevent writer starvation (and glibc does not implement it).
|
|||||||
|
|
||||||
Bug: http://www.mail-archive.com/bug-gnulib@gnu.org/msg33017.html
|
Bug: http://www.mail-archive.com/bug-gnulib@gnu.org/msg33017.html
|
||||||
---
|
---
|
||||||
gnulib-tests/test-lock.c | 2 +-
|
tests/test-lock.c | 2 +-
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/gnulib-tests/test-lock.c b/gnulib-tests/test-lock.c
|
diff --git a/tests/test-lock.c b/tests/test-lock.c
|
||||||
index a992f64..fd9c014 100644
|
index a992f64..fd9c014 100644
|
||||||
--- a/gnulib-tests/test-lock.c
|
--- a/tests/test-lock.c
|
||||||
+++ b/gnulib-tests/test-lock.c
|
+++ b/tests/test-lock.c
|
||||||
@@ -42,7 +42,7 @@
|
@@ -42,7 +42,7 @@
|
||||||
Uncomment some of these, to verify that all tests crash if no locking
|
Uncomment some of these, to verify that all tests crash if no locking
|
||||||
is enabled. */
|
is enabled. */
|
||||||
|
BIN
findutils-4.6.0.tar.gz.sig
Normal file
BIN
findutils-4.6.0.tar.gz.sig
Normal file
Binary file not shown.
@ -1,11 +0,0 @@
|
|||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
|
|
||||||
iQEzBAABCAAdFiEEpRidtpwRZNMwApNmRlAu95aRcZUFAl/53q8ACgkQRlAu95aR
|
|
||||||
cZVPlwgAshQRkDwagj5Zi1tFovX2GBbGfoTT9PddleIqGCieCy28GvVRkQNKf/q9
|
|
||||||
8hjZ5L/dKUhMPQuoiB6zlL2iVzWz/8pHxBIbCWUqWEIyoubSzPI6oSfpKmzODLNk
|
|
||||||
2BBWcM+7uTPEK7Q/l2GCk7R1txzFM7izk5wwyVNtq0ARjU0njUm3w6wSgKUcXKpR
|
|
||||||
deV4psEwSkkUzcZ/IBXKZrW41Dtj4LaS0AsIqj4j1lUsDyYd/NC4Z66GAlg80PRK
|
|
||||||
7TOv8AHels0nXpgJtWiwcIz74MmCfbMq8IL1vzoTVEMMYItRkGyREoGTKnDecjCm
|
|
||||||
w9GvH4sTRO0h7JDWjKMDXD2ZxHxXmg==
|
|
||||||
=QPJY
|
|
||||||
-----END PGP SIGNATURE-----
|
|
148
findutils.spec
148
findutils.spec
@ -1,30 +1,62 @@
|
|||||||
Summary: The GNU versions of find utilities (find and xargs)
|
Summary: The GNU versions of find utilities (find and xargs)
|
||||||
Name: findutils
|
Name: findutils
|
||||||
Version: 4.8.0
|
Version: 4.6.0
|
||||||
Release: 7%{?dist}
|
Release: 23%{?dist}
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: https://www.gnu.org/software/findutils/
|
Group: Applications/File
|
||||||
Source0: https://ftp.gnu.org/pub/gnu/%{name}/%{name}-%{version}.tar.xz
|
URL: http://www.gnu.org/software/findutils/
|
||||||
|
Source0: ftp://ftp.gnu.org/pub/gnu/findutils/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
# prevent mbrtowc tests from failing (#1294016)
|
||||||
|
Patch0: findutils-4.6.0-mbrtowc-tests.patch
|
||||||
|
|
||||||
# do not build locate
|
# do not build locate
|
||||||
Patch1: findutils-4.5.15-no-locate.patch
|
Patch1: findutils-4.5.15-no-locate.patch
|
||||||
|
|
||||||
# add -xautofs option to not descend into directories on autofs file systems
|
# fix build failure with glibc-2.28
|
||||||
Patch2: findutils-4.4.2-xautofs.patch
|
# https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
|
||||||
|
Patch2: findutils-4.6.0-gnulib-fflush.patch
|
||||||
|
|
||||||
|
# add a new option -xautofs to find to not descend into directories on autofs
|
||||||
|
# file systems
|
||||||
|
Patch3: findutils-4.4.2-xautofs.patch
|
||||||
|
|
||||||
# eliminate compile-time warnings
|
# eliminate compile-time warnings
|
||||||
Patch3: findutils-4.5.13-warnings.patch
|
Patch4: findutils-4.5.13-warnings.patch
|
||||||
|
|
||||||
|
# clarify exit status handling of -exec cmd {} + in find(1) man page (#1325049)
|
||||||
|
Patch5: findutils-4.6.0-man-exec.patch
|
||||||
|
|
||||||
|
# make sure that find -exec + passes all arguments (upstream bug #48030)
|
||||||
|
Patch6: findutils-4.6.0-exec-args.patch
|
||||||
|
|
||||||
|
# fix build failure with glibc-2.25+
|
||||||
|
Patch7: findutils-4.6.0-gnulib-makedev.patch
|
||||||
|
|
||||||
|
# avoid SIGSEGV in case the internal -noop option is used (#1346471)
|
||||||
|
Patch9: findutils-4.6.0-internal-noop.patch
|
||||||
|
|
||||||
# test-lock: disable the rwlock test
|
# test-lock: disable the rwlock test
|
||||||
Patch4: findutils-4.6.0-test-lock.patch
|
Patch10: findutils-4.6.0-test-lock.patch
|
||||||
|
|
||||||
|
# import gnulib's FTS module from upstream commit 281b825e (#1544429)
|
||||||
|
Patch11: findutils-4.6.0-fts-update.patch
|
||||||
|
|
||||||
# implement the -noleaf option of find (#1252549)
|
# implement the -noleaf option of find (#1252549)
|
||||||
Patch5: findutils-4.6.0-leaf-opt.patch
|
Patch12: findutils-4.6.0-leaf-opt.patch
|
||||||
|
|
||||||
# fix find not obeying option -ignore_readdir_race in symlink_loop (#2232519)
|
# fix programming mistakes detected by static analysis (#1606953)
|
||||||
Patch6: findutils-4.6.0-ignore_readdir_race-symlink_loop.patch
|
Patch13: findutils-4.6.0-covscan.patch
|
||||||
|
|
||||||
|
# fix find not obeying option -ignore_readdir_race in symlink_loop (#2232278)
|
||||||
|
Patch14: findutils-4.6.0-ignore_readdir_race-symlink_loop.patch
|
||||||
|
|
||||||
|
# manpage of find is incomplete regarding printf options (#1882695)
|
||||||
|
Patch15: findutils-4.6.0-improve-printf-Ak-description.patch
|
||||||
|
|
||||||
|
Requires(post): /sbin/install-info
|
||||||
|
Requires(preun): /sbin/install-info
|
||||||
Conflicts: filesystem < 3
|
Conflicts: filesystem < 3
|
||||||
Provides: /bin/find
|
Provides: /bin/find
|
||||||
Provides: bundled(gnulib)
|
Provides: bundled(gnulib)
|
||||||
@ -35,7 +67,6 @@ BuildRequires: gettext-devel
|
|||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: libselinux-devel
|
BuildRequires: libselinux-devel
|
||||||
BuildRequires: make
|
|
||||||
BuildRequires: texinfo
|
BuildRequires: texinfo
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -81,20 +112,18 @@ git add --all .
|
|||||||
git commit -q -m "after invocation of autoreconf"
|
git commit -q -m "after invocation of autoreconf"
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# disable -flto on ppc64le to make test-float pass (#1789115)
|
# prevent test-isinf from failing with gcc-5.3.1 on ppc64le (#1294016)
|
||||||
%ifarch ppc64le
|
export CFLAGS="$RPM_OPT_FLAGS -D__SUPPORT_SNAN__"
|
||||||
export CFLAGS="$RPM_OPT_FLAGS -fno-lto"
|
|
||||||
%endif
|
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
%global _configure ../configure
|
ln -s ../configure
|
||||||
%configure
|
%configure
|
||||||
|
|
||||||
%make_build
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
make %{?_smp_mflags} check -C build V=1
|
make %{?_smp_mflags} check -C build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install -C build
|
%make_install -C build
|
||||||
@ -103,7 +132,20 @@ rm -f %{buildroot}%{_infodir}/dir
|
|||||||
|
|
||||||
%find_lang %{name}
|
%find_lang %{name}
|
||||||
|
|
||||||
|
%post
|
||||||
|
if [ -f %{_infodir}/find.info.gz ]; then
|
||||||
|
/sbin/install-info %{_infodir}/find.info.gz %{_infodir}/dir || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
%preun
|
||||||
|
if [ $1 = 0 ]; then
|
||||||
|
if [ -f %{_infodir}/find.info.gz ]; then
|
||||||
|
/sbin/install-info --delete %{_infodir}/find.info.gz %{_infodir}/dir || :
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
%files -f %{name}.lang
|
%files -f %{name}.lang
|
||||||
|
%{!?_licensedir:%global license %%doc}
|
||||||
%license COPYING
|
%license COPYING
|
||||||
%doc AUTHORS NEWS README THANKS TODO
|
%doc AUTHORS NEWS README THANKS TODO
|
||||||
%{_bindir}/find
|
%{_bindir}/find
|
||||||
@ -111,68 +153,20 @@ rm -f %{buildroot}%{_infodir}/dir
|
|||||||
%{_mandir}/man1/find.1*
|
%{_mandir}/man1/find.1*
|
||||||
%{_mandir}/man1/xargs.1*
|
%{_mandir}/man1/xargs.1*
|
||||||
%{_infodir}/find.info*
|
%{_infodir}/find.info*
|
||||||
%{_infodir}/find-maint.info.*
|
%{_infodir}/find-maint.info.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Jul 04 2024 Lukáš Zaoral <lzaoral@redhat.com> - 1:4.8.0-7
|
* Thu Jul 04 2024 Lukáš Zaoral <lzaoral@redhat.com> - 1:4.6.0-23
|
||||||
- fix autofs patch when stat was not performed (RHEL-45721)
|
- fix autofs patch when stat was not performed (RHEL-45720)
|
||||||
|
|
||||||
* Thu Aug 17 2023 Lukáš Zaoral <lzaoral@redhat.com> - 1:4.8.0-6
|
* Mon Aug 21 2023 Lukáš Zaoral <lzaoral@redhat.com> - 1:4.6.0-22
|
||||||
- fix find not obeying option -ignore_readdir_race in symlink_loop (#2232519)
|
- improve description of printf options in find manpage (#1882695)
|
||||||
|
|
||||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1:4.8.0-5
|
* Wed Aug 16 2023 Lukáš Zaoral <lzaoral@redhat.com> - 1:4.6.0-21
|
||||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
- fix find not obeying option -ignore_readdir_race in symlink_loop (#2232278)
|
||||||
Related: rhbz#1991688
|
|
||||||
|
|
||||||
* Thu Jun 10 2021 Florian Weimer <fweimer@redhat.com> - 1:4.8.0-4
|
* Mon Nov 05 2018 Kamil Dudka <kdudka@redhat.com> - 1:4.6.0-20
|
||||||
- Rebuild with updated binutils (#1960667)
|
- fix programming mistakes detected by static analysis (#1606953)
|
||||||
|
|
||||||
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 1:4.8.0-3
|
|
||||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
|
||||||
|
|
||||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.8.0-2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
|
||||||
|
|
||||||
* Sat Jan 09 2021 Kamil Dudka <kdudka@redhat.com> - 1:4.8.0-1
|
|
||||||
- new upstream release
|
|
||||||
|
|
||||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.7.0-7
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Jul 24 2020 Kamil Dudka <kdudka@redhat.com> - 1:4.7.0-6
|
|
||||||
- disable -flto on ppc64le to make test-float pass (#1789115)
|
|
||||||
- do not compile with -D__SUPPORT_SNAN__ (#1294016)
|
|
||||||
|
|
||||||
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 1:4.7.0-5
|
|
||||||
- Use make macros
|
|
||||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
|
||||||
|
|
||||||
* Fri Apr 17 2020 Kamil Dudka <kdudka@redhat.com> - 1:4.7.0-4
|
|
||||||
- simplify leaf optimization for XFS (#1823247)
|
|
||||||
|
|
||||||
* Tue Feb 11 2020 Kamil Dudka <kdudka@redhat.com> - 1:4.7.0-3
|
|
||||||
- make upstream test-suite work with root privileges (#1799064)
|
|
||||||
|
|
||||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.7.0-2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Aug 30 2019 Kamil Dudka <kdudka@redhat.com> - 1:4.7.0-1
|
|
||||||
- new upstream release
|
|
||||||
|
|
||||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.6.0-24
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
|
||||||
|
|
||||||
* Wed Apr 24 2019 Björn Esser <besser82@fedoraproject.org> - 1:4.6.0-23
|
|
||||||
- Remove hardcoded gzip suffix from GNU info pages
|
|
||||||
|
|
||||||
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.6.0-22
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
|
||||||
|
|
||||||
* Mon Nov 05 2018 Kamil Dudka <kdudka@redhat.com> - 1:4.6.0-21
|
|
||||||
- fix programming mistakes detected by static analysis
|
|
||||||
|
|
||||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.6.0-20
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Apr 20 2018 Kamil Dudka <kdudka@redhat.com> - 1:4.6.0-19
|
* Fri Apr 20 2018 Kamil Dudka <kdudka@redhat.com> - 1:4.6.0-19
|
||||||
- fix crash caused by mistakenly enabled leaf optimization (#1558249)
|
- fix crash caused by mistakenly enabled leaf optimization (#1558249)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
--- !Policy
|
--- !Policy
|
||||||
product_versions:
|
product_versions:
|
||||||
- rhel-9
|
- rhel-8
|
||||||
decision_context: osci_compose_gate
|
decision_context: osci_compose_gate
|
||||||
rules:
|
rules:
|
||||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tier1-internal.functional}
|
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||||
|
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
summary: Internal gating tests plan
|
|
||||||
discover:
|
|
||||||
- name: Internal gating tests
|
|
||||||
how: fmf
|
|
||||||
filter: 'tag: Tier1,Tier2,Tier3 & tag: -rhel-buildroot'
|
|
||||||
url: https://pkgs.devel.redhat.com/git/tests/findutils
|
|
||||||
execute:
|
|
||||||
how: tmt
|
|
||||||
adjust:
|
|
||||||
enabled: false
|
|
||||||
when: distro == centos-stream or distro == fedora
|
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
SHA512 (findutils-4.8.0.tar.xz) = eaa2da304dbeb2cd659b9210ac37da1bde4cd665c12a818eca98541c5ed5cba1050641fc0c39c0a446a5a7a87a8d654df0e0e6b0cee21752ea485188c9f1071e
|
SHA512 (findutils-4.6.0.tar.gz) = 41fcd4197c1efbd77f7420e5754e2cf9332dfef19f90c65a8fa1844bb4bc5d529c8393ee0ff979a054e9ac65ff71d7fe3921ea079f9960843412fc9a71f8afd4
|
||||||
|
63
tests/smoke/Makefile
Normal file
63
tests/smoke/Makefile
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Makefile of /CoreOS/findutils/Sanity/smoke
|
||||||
|
# Description: Smoke test for find and xargs.
|
||||||
|
# Author: Branislav Nater <bnater@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# This copyrighted material is made available to anyone wishing
|
||||||
|
# to use, modify, copy, or redistribute it subject to the terms
|
||||||
|
# and conditions of the GNU General Public License version 2.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be
|
||||||
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE. See the GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public
|
||||||
|
# License along with this program; if not, write to the Free
|
||||||
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
export TEST=/CoreOS/findutils/Sanity/smoke
|
||||||
|
export TESTVERSION=1.0
|
||||||
|
|
||||||
|
BUILT_FILES=
|
||||||
|
|
||||||
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||||
|
|
||||||
|
.PHONY: all install download clean
|
||||||
|
|
||||||
|
run: $(FILES) build
|
||||||
|
./runtest.sh
|
||||||
|
|
||||||
|
build: $(BUILT_FILES)
|
||||||
|
test -x runtest.sh || chmod a+x runtest.sh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ $(BUILT_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
include /usr/share/rhts/lib/rhts-make.include
|
||||||
|
|
||||||
|
$(METADATA): Makefile
|
||||||
|
@echo "Owner: Branislav Nater <bnater@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: Smoke test for find and xargs." >> $(METADATA)
|
||||||
|
@echo "Type: Sanity" >> $(METADATA)
|
||||||
|
@echo "TestTime: 5m" >> $(METADATA)
|
||||||
|
@echo "RunFor: findutils" >> $(METADATA)
|
||||||
|
@echo "Requires: findutils" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv2" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
|
||||||
|
rhts-lint $(METADATA)
|
3
tests/smoke/PURPOSE
Normal file
3
tests/smoke/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PURPOSE of /CoreOS/findutils/Sanity/smoke
|
||||||
|
Description: Smoke test for find and xargs.
|
||||||
|
Author: Branislav Nater <bnater@redhat.com>
|
64
tests/smoke/runtest.sh
Executable file
64
tests/smoke/runtest.sh
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# runtest.sh of /CoreOS/findutils/Sanity/smoke
|
||||||
|
# Description: Smoke test for find and xargs.
|
||||||
|
# Author: Branislav Nater <bnater@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# This copyrighted material is made available to anyone wishing
|
||||||
|
# to use, modify, copy, or redistribute it subject to the terms
|
||||||
|
# and conditions of the GNU General Public License version 2.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be
|
||||||
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE. See the GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public
|
||||||
|
# License along with this program; if not, write to the Free
|
||||||
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
# Include rhts environment
|
||||||
|
. /usr/bin/rhts-environment.sh || exit 1
|
||||||
|
. /usr/lib/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
|
PACKAGE="findutils"
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
rlPhaseStartSetup
|
||||||
|
rlAssertRpm $PACKAGE
|
||||||
|
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||||
|
rlRun "pushd $TmpDir"
|
||||||
|
rlRun "touch \"file with spaces\"" 0
|
||||||
|
rlRun "mkdir dir" 0
|
||||||
|
rlRun "touch dir/file1" 0
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlGetTestState && {
|
||||||
|
rlPhaseStartTest
|
||||||
|
rlRun "find . -name \"file*\" -type f | tee output | wc -l > wcout" 0
|
||||||
|
cat output
|
||||||
|
rlAssertGrep 2 wcout
|
||||||
|
rlRun "find $TmpDir -mindepth 1 -type d | tee output | wc -l > wcout" 0
|
||||||
|
cat output
|
||||||
|
rlAssertGrep 1 wcout
|
||||||
|
rlRun "find $TmpDir -name \"file*\" -print0 | xargs -0 ls -l | tee output | wc -l > wcout" 0
|
||||||
|
cat output
|
||||||
|
rlAssertGrep 2 wcout
|
||||||
|
rlPhaseEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
rlRun "popd"
|
||||||
|
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||||
|
rlPhaseEnd
|
||||||
|
rlJournalEnd
|
||||||
|
rlJournalPrintText
|
14
tests/tests.yml
Normal file
14
tests/tests.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
# Tests which will run in all contexts
|
||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-beakerlib
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
- container
|
||||||
|
- atomic
|
||||||
|
tests:
|
||||||
|
- smoke
|
||||||
|
- xautofs
|
||||||
|
required_packages:
|
||||||
|
- autofs # autofs required for xautofs test
|
65
tests/xautofs/Makefile
Normal file
65
tests/xautofs/Makefile
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Makefile of /CoreOS/findutils/Sanity/options/xautofs
|
||||||
|
# Description: Check xautofs option
|
||||||
|
# Author: Petr Splichal <psplicha@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# This copyrighted material is made available to anyone wishing
|
||||||
|
# to use, modify, copy, or redistribute it subject to the terms
|
||||||
|
# and conditions of the GNU General Public License version 2.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be
|
||||||
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE. See the GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public
|
||||||
|
# License along with this program; if not, write to the Free
|
||||||
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
export TEST=/CoreOS/findutils/Sanity/options/xautofs
|
||||||
|
export TESTVERSION=1.0
|
||||||
|
|
||||||
|
BUILT_FILES=
|
||||||
|
|
||||||
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||||
|
|
||||||
|
.PHONY: all install download clean
|
||||||
|
|
||||||
|
run: $(FILES) build
|
||||||
|
./runtest.sh
|
||||||
|
|
||||||
|
build: $(BUILT_FILES)
|
||||||
|
chmod a+x runtest.sh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ $(BUILT_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
include /usr/share/rhts/lib/rhts-make.include
|
||||||
|
|
||||||
|
$(METADATA): Makefile
|
||||||
|
@echo "Owner: Branislav Nater <bnater@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: Check xautofs option" >> $(METADATA)
|
||||||
|
@echo "Type: Sanity" >> $(METADATA)
|
||||||
|
@echo "TestTime: 10m" >> $(METADATA)
|
||||||
|
@echo "RunFor: findutils" >> $(METADATA)
|
||||||
|
@echo "Requires: autofs findutils" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv2" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
@echo "Bug: 485672 529391" >> $(METADATA)
|
||||||
|
@echo "Releases: -RHEL3 -RHEL4" >> $(METADATA)
|
||||||
|
|
||||||
|
rhts-lint $(METADATA)
|
8
tests/xautofs/PURPOSE
Normal file
8
tests/xautofs/PURPOSE
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
PURPOSE of /CoreOS/findutils/Sanity/options/xautofs
|
||||||
|
Description: Check xautofs option
|
||||||
|
Author: Petr Splichal <psplicha@redhat.com>
|
||||||
|
Bug summary: [RFE] Modify find to be able to skip direct mapped autofs mounts
|
||||||
|
Bugzilla link: None
|
||||||
|
|
||||||
|
Check that the new -xautofs option works as expected: make sure
|
||||||
|
find does not descend into directories on autofs filesystems.
|
90
tests/xautofs/runtest.sh
Executable file
90
tests/xautofs/runtest.sh
Executable file
@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# runtest.sh of /CoreOS/findutils/Sanity/options/xautofs
|
||||||
|
# Description: Check xautofs option
|
||||||
|
# Author: Petr Splichal <psplicha@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# This copyrighted material is made available to anyone wishing
|
||||||
|
# to use, modify, copy, or redistribute it subject to the terms
|
||||||
|
# and conditions of the GNU General Public License version 2.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be
|
||||||
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE. See the GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public
|
||||||
|
# License along with this program; if not, write to the Free
|
||||||
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
# Include rhts environment
|
||||||
|
. /usr/bin/rhts-environment.sh
|
||||||
|
. /usr/share/rhts-library/rhtslib.sh
|
||||||
|
|
||||||
|
PACKAGE="findutils"
|
||||||
|
|
||||||
|
MasterConf="/etc/auto.master"
|
||||||
|
DirectConf="/etc/auto.direct"
|
||||||
|
|
||||||
|
MountDir="/mnt/findutils"
|
||||||
|
AutomountDir="$MountDir/etc"
|
||||||
|
RegularDir="$MountDir/regular/directory/master"
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
rlPhaseStartSetup
|
||||||
|
rlAssertRpm $PACKAGE
|
||||||
|
rlAssertRpm "autofs"
|
||||||
|
rlRun "set -o pipefail"
|
||||||
|
|
||||||
|
# create dirs & back up
|
||||||
|
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
||||||
|
rlRun "mkdir -p $RegularDir" 0 "Creating regular directory"
|
||||||
|
rlRun "rlFileBackup $MasterConf"
|
||||||
|
|
||||||
|
# set up autofs
|
||||||
|
rlRun "echo '/- /etc/auto.direct' > $MasterConf" \
|
||||||
|
0 "Setting up autofs master map"
|
||||||
|
rlRun "echo '$AutomountDir localhost:/etc' > $DirectConf" \
|
||||||
|
0 "Setting up autofs direct map"
|
||||||
|
|
||||||
|
# RHEL-7 is using xfs
|
||||||
|
rlIsRHEL 4 5 6 && fs="ext[34]" || fs="xfs"
|
||||||
|
|
||||||
|
rlRun "pushd $TmpDir"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest "Without -xautofs option"
|
||||||
|
rlRun "rlServiceStart autofs" 0 "Starting autofs"
|
||||||
|
rlAssertNotGrep "$AutomountDir.*$fs" "/proc/mounts"
|
||||||
|
rlRun "find $MountDir -noleaf -name '*master*' | tee filelist"
|
||||||
|
rlAssertGrep "$RegularDir" "filelist"
|
||||||
|
rlAssertGrep "$MountDir$MasterConf" "filelist"
|
||||||
|
rlAssertGrep "$AutomountDir.*$fs" "/proc/mounts"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest "With -xautofs option"
|
||||||
|
rlRun "rlServiceStart autofs" 0 "Starting autofs"
|
||||||
|
rlAssertNotGrep "$AutomountDir.*$fs" "/proc/mounts"
|
||||||
|
rlRun "find $MountDir -xautofs -noleaf -name '*master*' | tee filelist"
|
||||||
|
rlAssertGrep "$RegularDir" "filelist"
|
||||||
|
rlAssertNotGrep "$MountDir$MasterConf" "filelist"
|
||||||
|
rlAssertNotGrep "$AutomountDir.*$fs" "/proc/mounts"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
rlRun "popd"
|
||||||
|
rlRun "rlFileRestore"
|
||||||
|
rlRun "rlServiceRestore autofs"
|
||||||
|
rlRun "rm -r $TmpDir $DirectConf $MountDir" 0 "Removing tmp files"
|
||||||
|
rlPhaseEnd
|
||||||
|
rlJournalPrintText
|
||||||
|
rlJournalEnd
|
Loading…
Reference in New Issue
Block a user