Compare commits
No commits in common. "67a6e3bc8505206cd379cd625cf7224faf75ed1d" and "6257ecf46784cab90887f442296d2d6d9ff646f0" have entirely different histories.
67a6e3bc85
...
6257ecf467
@ -1,60 +1,34 @@
|
||||
From 547e7145f335dc07144f35eaacc520475068852e Mon Sep 17 00:00:00 2001
|
||||
From 79962cf9eecbf5e67e195f48aa5ab890fbed9250 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"
|
||||
Date: Thu, 13 Feb 2020 09:59:09 +0800
|
||||
Subject: [PATCH] findutils leaf opt
|
||||
|
||||
This reverts commit dce8759f0f0236a860a3e68b63c5e99cc6f168f9.
|
||||
---
|
||||
gl/lib/fts_.h | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
find/ftsfind.c | 3 +++
|
||||
gl/lib/fts.c | 4 ++++
|
||||
gl/lib/fts_.h | 16 ++++++++++++----
|
||||
3 files changed, 19 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
|
||||
diff --git a/find/ftsfind.c b/find/ftsfind.c
|
||||
index 69a3d8d..d207f90 100644
|
||||
--- a/find/ftsfind.c
|
||||
+++ b/find/ftsfind.c
|
||||
@@ -553,6 +553,9 @@ find (char *arg)
|
||||
if (options.stay_on_filesystem)
|
||||
ftsoptions |= FTS_XDEV;
|
||||
|
||||
+/* 0x0800 unused, was non-working FTS_NOATIME */
|
||||
+ if (options.no_leaf_check)
|
||||
+ ftsoptions |= FTS_NOLEAF;
|
||||
+
|
||||
/* 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: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Fri, 25 Sep 2015 16:09:39 +0200
|
||||
Subject: [PATCH 2/3] fts: introduce the FTS_NOLEAF flag
|
||||
|
||||
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_.h (FTS_NOLEAF): New macro, shifted conflicting constants.
|
||||
---
|
||||
gl/lib/fts.c | 4 ++++
|
||||
gl/lib/fts_.h | 12 +++++++++---
|
||||
2 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
p = fts_open (arglist, ftsoptions, NULL);
|
||||
if (NULL == p)
|
||||
{
|
||||
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
|
||||
index d2d404f..808466f 100644
|
||||
index 8b7a4de..1093ce5 100644
|
||||
--- a/gl/lib/fts.c
|
||||
+++ b/gl/lib/fts.c
|
||||
@@ -706,6 +706,10 @@ filesystem_type (FTSENT const *p, int fd)
|
||||
@@ -713,6 +713,10 @@ filesystem_type (FTSENT const *p, int fd)
|
||||
struct dev_type *ent;
|
||||
struct statfs fs_buf;
|
||||
|
||||
@ -66,57 +40,36 @@ index d2d404f..808466f 100644
|
||||
since the caller is not serious about performance. */
|
||||
if (!ISSET (FTS_CWDFD))
|
||||
diff --git a/gl/lib/fts_.h b/gl/lib/fts_.h
|
||||
index 63d4b74..f1d519b 100644
|
||||
index fb5558f..d40a116 100644
|
||||
--- a/gl/lib/fts_.h
|
||||
+++ b/gl/lib/fts_.h
|
||||
@@ -155,10 +155,16 @@ typedef struct {
|
||||
from input path names during fts_open initialization. */
|
||||
# define FTS_VERBATIM 0x1000
|
||||
@@ -149,14 +149,22 @@ typedef struct {
|
||||
dirent.d_type data. */
|
||||
# define FTS_DEFER_STAT 0x0400
|
||||
|
||||
-# define FTS_OPTIONMASK 0x1fff /* valid user option mask */
|
||||
+/* 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
|
||||
+
|
||||
+ /* Disable leaf optimization (which eliminates stat() calls during traversal,
|
||||
+ based on the count of nested directories stored in stat.st_nlink of each
|
||||
+ directory). Note that the optimization is by default enabled only for
|
||||
+ selected file systems, and only if the FTS_CWDFD flag is set. */
|
||||
+# define FTS_NOLEAF 0x2000
|
||||
|
||||
-# define FTS_NAMEONLY 0x2000 /* (private) child names only */
|
||||
-# define FTS_STOP 0x4000 /* (private) unrecoverable error */
|
||||
-# define FTS_OPTIONMASK 0x0fff /* valid user option mask */
|
||||
+# define FTS_OPTIONMASK 0x3fff /* valid user option mask */
|
||||
+
|
||||
|
||||
-# define FTS_NAMEONLY 0x1000 /* (private) child names only */
|
||||
-# define FTS_STOP 0x2000 /* (private) unrecoverable error */
|
||||
+# define FTS_NAMEONLY 0x4000 /* (private) child names only */
|
||||
+# define FTS_STOP 0x8000 /* (private) unrecoverable error */
|
||||
int fts_options; /* fts_open options, global flags */
|
||||
|
||||
/* Map a directory's device number to a boolean. The boolean is
|
||||
--
|
||||
2.5.0
|
||||
|
||||
|
||||
From c186934e6e37ddadf7511abb9b1045192757618e Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Fri, 25 Sep 2015 19:13:15 +0200
|
||||
Subject: [PATCH 3/3] ftsfind: propagate the -noleaf option to FTS
|
||||
|
||||
* find/ftsfind.c (find): Propagate the -noleaf option to FTS.
|
||||
---
|
||||
find/ftsfind.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/find/ftsfind.c b/find/ftsfind.c
|
||||
index 5159470..e34b672 100644
|
||||
--- a/find/ftsfind.c
|
||||
+++ b/find/ftsfind.c
|
||||
@@ -509,6 +509,9 @@ find (char *arg)
|
||||
if (options.stay_on_filesystem)
|
||||
ftsoptions |= FTS_XDEV;
|
||||
|
||||
+ if (options.no_leaf_check)
|
||||
+ ftsoptions |= FTS_NOLEAF;
|
||||
+
|
||||
p = fts_open (arglist, ftsoptions, NULL);
|
||||
if (NULL == p)
|
||||
{
|
||||
--
|
||||
2.5.0
|
||||
1.8.3.1
|
||||
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
From 17e470dc1acca4824b70328d733d5f99c12d0d65 Mon Sep 17 00:00:00 2001
|
||||
From 96c16e761f5a60b29197181400fa2a8e3603ebf9 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Wed, 11 May 2011 16:46:45 +0200
|
||||
Subject: [PATCH] findutils-4.4.2-xautofs.patch
|
||||
Date: Thu, 13 Feb 2020 09:49:30 +0800
|
||||
Subject: [PATCH] findutils xautofs
|
||||
|
||||
---
|
||||
doc/find.texi | 4 ++++
|
||||
find/defs.h | 3 +++
|
||||
find/find.1 | 3 +++
|
||||
find/ftsfind.c | 6 ++++++
|
||||
find/parser.c | 9 +++++++++
|
||||
find/util.c | 3 ++-
|
||||
6 files changed, 27 insertions(+), 1 deletions(-)
|
||||
doc/find.texi | 4 ++++
|
||||
find/defs.h | 3 +++
|
||||
find/find.1 | 3 +++
|
||||
find/ftsfind.c | 6 ++++++
|
||||
find/parser.c | 9 +++++++++
|
||||
find/util.c | 3 ++-
|
||||
6 files changed, 27 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/doc/find.texi b/doc/find.texi
|
||||
index c584298..9731b71 100644
|
||||
index a410b29..42a4257 100644
|
||||
--- a/doc/find.texi
|
||||
+++ b/doc/find.texi
|
||||
@@ -1606,6 +1606,10 @@ them.
|
||||
@@ -1475,6 +1475,10 @@ them.
|
||||
There are two ways to avoid searching certain filesystems. One way is
|
||||
to tell @code{find} to only search one filesystem:
|
||||
|
||||
@ -28,10 +28,10 @@ index c584298..9731b71 100644
|
||||
@deffnx Option -mount
|
||||
Don't descend directories on other filesystems. These options are
|
||||
diff --git a/find/defs.h b/find/defs.h
|
||||
index 11d1d00..f95ce72 100644
|
||||
index 9b5e506..c0a0bba 100644
|
||||
--- a/find/defs.h
|
||||
+++ b/find/defs.h
|
||||
@@ -562,6 +562,9 @@ struct options
|
||||
@@ -574,6 +574,9 @@ struct options
|
||||
/* If true, don't cross filesystem boundaries. */
|
||||
bool stay_on_filesystem;
|
||||
|
||||
@ -42,10 +42,10 @@ index 11d1d00..f95ce72 100644
|
||||
* no longer exists by the time we get around to processing it.
|
||||
*/
|
||||
diff --git a/find/find.1 b/find/find.1
|
||||
index e851f82..a4799ff 100644
|
||||
index bcc1b32..7f4a733 100644
|
||||
--- a/find/find.1
|
||||
+++ b/find/find.1
|
||||
@@ -638,6 +638,9 @@ to stat them; this gives a significant increase in search speed.
|
||||
@@ -567,6 +567,9 @@ to stat them; this gives a significant increase in search speed.
|
||||
.IP "\-version, \-\-version"
|
||||
Print the \fBfind\fR version number and exit.
|
||||
|
||||
@ -56,10 +56,10 @@ index e851f82..a4799ff 100644
|
||||
Don't descend directories on other filesystems.
|
||||
|
||||
diff --git a/find/ftsfind.c b/find/ftsfind.c
|
||||
index 9fdb8ef..bd7cc37 100644
|
||||
index 0d96c4c..69a3d8d 100644
|
||||
--- a/find/ftsfind.c
|
||||
+++ b/find/ftsfind.c
|
||||
@@ -435,6 +435,12 @@ consider_visiting (FTS *p, FTSENT *ent)
|
||||
@@ -479,6 +479,12 @@ consider_visiting (FTS *p, FTSENT *ent)
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,10 +73,10 @@ index 9fdb8ef..bd7cc37 100644
|
||||
{
|
||||
/* this is the preorder visit, but user said -depth */
|
||||
diff --git a/find/parser.c b/find/parser.c
|
||||
index 52a1ef6..995aec3 100644
|
||||
index 5770487..8c66b0a 100644
|
||||
--- a/find/parser.c
|
||||
+++ b/find/parser.c
|
||||
@@ -139,6 +139,7 @@ static bool parse_used (const struct parser_table*, char *argv[], int *
|
||||
@@ -138,6 +138,7 @@ static bool parse_used (const struct parser_table*, char *argv[], int *
|
||||
static bool parse_user (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);
|
||||
@ -84,7 +84,7 @@ index 52a1ef6..995aec3 100644
|
||||
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_warn (const struct parser_table*, char *argv[], int *arg_ptr);
|
||||
@@ -304,6 +305,7 @@ static struct parser_table const parse_table[] =
|
||||
@@ -302,6 +303,7 @@ static struct parser_table const parse_table[] =
|
||||
PARSE_TEST_NP ("wholename", wholename), /* GNU, replaced -path, but now -path is standardized since POSIX 2008 */
|
||||
{ARG_TEST, "writable", parse_accesscheck, pred_writable}, /* GNU, 4.3.0+ */
|
||||
PARSE_OPTION ("xdev", xdev), /* POSIX */
|
||||
@ -92,34 +92,34 @@ index 52a1ef6..995aec3 100644
|
||||
PARSE_TEST ("xtype", xtype), /* GNU */
|
||||
#ifdef UNIMPLEMENTED_UNIX
|
||||
/* It's pretty ugly for find to know about archive formats.
|
||||
@@ -2607,6 +2609,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
|
||||
return parse_noop (entry, argv, arg_ptr);
|
||||
@@ -2604,6 +2606,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
|
||||
}
|
||||
|
||||
+static bool
|
||||
static bool
|
||||
+parse_xautofs (const struct parser_table* entry, char **argv, int *arg_ptr)
|
||||
+{
|
||||
+ options.bypass_autofs = true;
|
||||
+ return parse_noop (entry, argv, arg_ptr);
|
||||
+}
|
||||
+
|
||||
static bool
|
||||
+static bool
|
||||
parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr)
|
||||
{
|
||||
options.ignore_readdir_race = true;
|
||||
diff --git a/find/util.c b/find/util.c
|
||||
index 8577396..4d45f84 100644
|
||||
index aa387a4..a10f169 100644
|
||||
--- a/find/util.c
|
||||
+++ b/find/util.c
|
||||
@@ -183,7 +183,7 @@ Positional options (always true):\n\
|
||||
HTL (_("\n\
|
||||
Normal options (always true, specified before other expressions):\n\
|
||||
-depth -files0-from FILE -maxdepth LEVELS -mindepth LEVELS\n\
|
||||
- -mount -noleaf -xdev -ignore_readdir_race -noignore_readdir_race\n"));
|
||||
+ -mount -noleaf -xautofs -xdev -ignore_readdir_race -noignore_readdir_race\n"));
|
||||
HTL (_("\n\
|
||||
Tests (N can be +N or -N or N):\n\
|
||||
-amin N -anewer FILE -atime N -cmin N -cnewer FILE -context CONTEXT\n\
|
||||
@@ -1028,6 +1028,7 @@ set_option_defaults (struct options *p)
|
||||
@@ -181,7 +181,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"));
|
||||
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->stay_on_filesystem = false;
|
||||
@ -128,5 +128,5 @@ index 8577396..4d45f84 100644
|
||||
|
||||
if (p->posixly_correct)
|
||||
--
|
||||
1.7.4.4
|
||||
1.8.3.1
|
||||
|
||||
|
||||
129
0001-tests-avoid-FP-when-run-as-root.patch
Normal file
129
0001-tests-avoid-FP-when-run-as-root.patch
Normal file
@ -0,0 +1,129 @@
|
||||
From 2f9fff9e1f0c0b7a9034d7c46ca197ce693c4736 Mon Sep 17 00:00:00 2001
|
||||
From: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||
Date: Sun, 9 Feb 2020 19:58:07 +0100
|
||||
Subject: [PATCH] tests: avoid FP when run as root
|
||||
|
||||
Test 'sv-bug-54171' produced a false-positive error as 'find' would
|
||||
not fail for an unreadable directory when run as root.
|
||||
Migrate the test to the newer shell-based tests, and add the
|
||||
'skip_if_root_' guard to avoid a false-positive.
|
||||
|
||||
* find/testsuite/find.posix/sv-bug-54171.exp: Remove.
|
||||
* find/testsuite/find.posix/sv-bug-54171.xo: Remove.
|
||||
* find/testsuite/Makefile.am (EXTRA_DIST_XO, EXTRA_DIST_EXP): Remove the
|
||||
above deleted test.
|
||||
* tests/find/depth-unreadable-dir.sh: Add test.
|
||||
* tests/local.mk (all_tests): Reference it.
|
||||
|
||||
Test FP introduced in commit v4.6.0-178-gdf4610d0.
|
||||
Fixes https://savannah.gnu.org/bugs/?57762
|
||||
and https://bugzilla.redhat.com/1799064
|
||||
---
|
||||
find/testsuite/Makefile.am | 2 --
|
||||
find/testsuite/find.posix/sv-bug-54171.exp | 5 ----
|
||||
find/testsuite/find.posix/sv-bug-54171.xo | 1 -
|
||||
tests/find/depth-unreadable-dir.sh | 39 ++++++++++++++++++++++++++++++
|
||||
tests/local.mk | 1 +
|
||||
5 files changed, 40 insertions(+), 8 deletions(-)
|
||||
delete mode 100644 find/testsuite/find.posix/sv-bug-54171.exp
|
||||
delete mode 100644 find/testsuite/find.posix/sv-bug-54171.xo
|
||||
create mode 100755 tests/find/depth-unreadable-dir.sh
|
||||
|
||||
diff --git a/find/testsuite/Makefile.am b/find/testsuite/Makefile.am
|
||||
index d252451..77a2902 100644
|
||||
--- a/find/testsuite/Makefile.am
|
||||
+++ b/find/testsuite/Makefile.am
|
||||
@@ -119,7 +119,6 @@ find.posix/prune-stat.xo \
|
||||
find.posix/sizetype.xo \
|
||||
find.posix/sv-bug-15235.xo \
|
||||
find.posix/sv-bug-19613.xo \
|
||||
-find.posix/sv-bug-54171.xo \
|
||||
find.posix/typesize.xo
|
||||
|
||||
|
||||
@@ -246,7 +245,6 @@ find.posix/sv-bug-15235.exp \
|
||||
find.posix/sv-bug-19605.exp \
|
||||
find.posix/sv-bug-19613.exp \
|
||||
find.posix/sv-bug-19617.exp \
|
||||
-find.posix/sv-bug-54171.exp \
|
||||
find.posix/typesize.exp \
|
||||
find.posix/user-empty.exp \
|
||||
find.posix/user-missing.exp
|
||||
diff --git a/find/testsuite/find.posix/sv-bug-54171.exp b/find/testsuite/find.posix/sv-bug-54171.exp
|
||||
deleted file mode 100644
|
||||
index 8e5448f..0000000
|
||||
--- a/find/testsuite/find.posix/sv-bug-54171.exp
|
||||
+++ /dev/null
|
||||
@@ -1,5 +0,0 @@
|
||||
-exec rm -rf tmp
|
||||
-exec mkdir tmp tmp/dir
|
||||
-exec chmod 0311 tmp/dir
|
||||
-find_start f {tmp -depth -name dir }
|
||||
-exec rm -rf tmp
|
||||
diff --git a/find/testsuite/find.posix/sv-bug-54171.xo b/find/testsuite/find.posix/sv-bug-54171.xo
|
||||
deleted file mode 100644
|
||||
index 2dc4706..0000000
|
||||
--- a/find/testsuite/find.posix/sv-bug-54171.xo
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-tmp/dir
|
||||
diff --git a/tests/find/depth-unreadable-dir.sh b/tests/find/depth-unreadable-dir.sh
|
||||
new file mode 100755
|
||||
index 0000000..86e2fd6
|
||||
--- /dev/null
|
||||
+++ b/tests/find/depth-unreadable-dir.sh
|
||||
@@ -0,0 +1,39 @@
|
||||
+#!/bin/sh
|
||||
+# find -depth: ensure to output an unreadable directory.
|
||||
+
|
||||
+# Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
|
||||
+print_ver_ find
|
||||
+
|
||||
+# Find run as root would not fail for an unreadable directory.
|
||||
+skip_if_root_
|
||||
+
|
||||
+# Prepare an unreadable directory, and the expected stdout/stderr.
|
||||
+mkdir tmp tmp/dir \
|
||||
+ && chmod 0311 tmp/dir \
|
||||
+ && echo 'tmp/dir' > exp \
|
||||
+ && echo "find: 'tmp/dir': Permission denied" > experr \
|
||||
+ || framework_failure_
|
||||
+
|
||||
+# Run FTS-based find with -depth; versions < 4.7.0 failed to output
|
||||
+# an unreadable directory (see #54171).
|
||||
+returns_ 1 find tmp -depth -name dir > out 2> err || fail=1
|
||||
+
|
||||
+compare exp out || fail=1
|
||||
+compare experr err || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index dccc734..986df55 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -106,6 +106,7 @@ check-root:
|
||||
|
||||
all_tests = \
|
||||
tests/misc/help-version.sh \
|
||||
+ tests/find/depth-unreadable-dir.sh \
|
||||
tests/find/many-dir-entries-vs-OOM.sh \
|
||||
tests/find/name-lbracket-literal.sh \
|
||||
tests/find/printf_escapechars.sh \
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
159
0004-fts-remove-NOSTAT_LEAF_OPTIMIZATION.patch
Normal file
159
0004-fts-remove-NOSTAT_LEAF_OPTIMIZATION.patch
Normal file
@ -0,0 +1,159 @@
|
||||
rom 47bf2cf3184027c1eb9c1dfeea5c5b8b2d69710d Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Wed, 15 Apr 2020 20:50:32 -0700
|
||||
Subject: [PATCH] fts: remove NOSTAT_LEAF_OPTIMIZATION
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It caused ‘find’ and ‘du’ to dump core, and it was useful
|
||||
only for obsolescent Linux filesystems anyway. Problem reported in:
|
||||
https://lists.gnu.org/r/bug-gnulib/2020-04/msg00068.html
|
||||
Quite possibly there is still a serious underlying fts bug with
|
||||
tight-loop-check and mutating file systems, but if so this patch
|
||||
should cause the bug to be triggered less often.
|
||||
* lib/fts.c (enum leaf_optimization): Remove
|
||||
NOSTAT_LEAF_OPTIMIZATION, as it’s problematic.
|
||||
(S_MAGIC_REISERFS, S_MAGIC_XFS): Remove; no longer needed.
|
||||
(leaf_optimization): Remove special cases for ReiserFS and XFS.
|
||||
(fts_read): Remove NOSTAT_LEAF_OPTIMIZATION code.
|
||||
* lib/fts_.h (struct _ftsent.fts_n_dirs_remaining):
|
||||
Remove. All uses removed.
|
||||
---
|
||||
ChangeLog | 17 +++++++++++++++++
|
||||
lib/fts.c | 56 ++++++++------------------------------------------------
|
||||
lib/fts_.h | 5 -----
|
||||
3 files changed, 25 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
|
||||
index 1093ce5..dfe3fef 100644
|
||||
--- a/gl/lib/fts.c
|
||||
+++ b/gl/lib/fts.c
|
||||
@@ -445,7 +445,6 @@ 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
|
||||
@@ -634,9 +633,8 @@ fts_close (FTS *sp)
|
||||
}
|
||||
|
||||
/* 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
|
||||
- ".."). */
|
||||
+ optimization is OK and a directory's st_nlink == MIN_DIR_NLINK,
|
||||
+ then the directory has no subdirectories. */
|
||||
enum { MIN_DIR_NLINK = 2 };
|
||||
|
||||
/* Whether leaf optimization is OK for a directory. */
|
||||
@@ -645,12 +643,8 @@ 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
|
||||
+ /* st_nlink == 2 means the directory lacks subdirectories. */
|
||||
+ OK_LEAF_OPTIMIZATION
|
||||
};
|
||||
|
||||
#if (defined __linux__ || defined __ANDROID__) \
|
||||
@@ -663,9 +657,7 @@ enum leaf_optimization
|
||||
# define S_MAGIC_CIFS 0xFF534D42
|
||||
# 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
|
||||
|
||||
# ifdef HAVE___FSWORD_T
|
||||
typedef __fsword_t fsword;
|
||||
@@ -786,23 +778,15 @@ dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
|
||||
}
|
||||
|
||||
/* 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.
|
||||
+ return whether it is valid to apply leaf optimization.
|
||||
+ The optimization is valid if a directory's st_nlink value equal
|
||||
+ to MIN_DIR_NLINK means the directory has no subdirectories.
|
||||
DIR_FD is negative if unavailable. */
|
||||
static enum leaf_optimization
|
||||
leaf_optimization (FTSENT const *p, int dir_fd)
|
||||
{
|
||||
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. */
|
||||
- case S_MAGIC_REISERFS:
|
||||
- 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;
|
||||
@@ -1027,26 +1011,7 @@ check_for_dir:
|
||||
if (p->fts_info == FTS_NSOK)
|
||||
{
|
||||
if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
|
||||
- {
|
||||
- FTSENT *parent = p->fts_parent;
|
||||
- if (parent->fts_n_dirs_remaining == 0
|
||||
- && ISSET(FTS_NOSTAT)
|
||||
- && ISSET(FTS_PHYSICAL)
|
||||
- && (leaf_optimization (parent, sp->fts_cwd_fd)
|
||||
- == NOSTAT_LEAF_OPTIMIZATION))
|
||||
- {
|
||||
- /* nothing more needed */
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- p->fts_info = fts_stat(sp, p, false);
|
||||
- if (S_ISDIR(p->fts_statp->st_mode)
|
||||
- && p->fts_level != FTS_ROOTLEVEL
|
||||
- && 0 < parent->fts_n_dirs_remaining
|
||||
- && parent->fts_n_dirs_remaining != (nlink_t) -1)
|
||||
- parent->fts_n_dirs_remaining--;
|
||||
- }
|
||||
- }
|
||||
+ p->fts_info = fts_stat(sp, p, false);
|
||||
else
|
||||
fts_assert (p->fts_statp->st_size == FTS_NO_STAT_REQUIRED);
|
||||
}
|
||||
@@ -1830,11 +1795,6 @@ err: memset(sbp, 0, sizeof(struct stat));
|
||||
}
|
||||
|
||||
if (S_ISDIR(sbp->st_mode)) {
|
||||
- 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);
|
||||
diff --git a/gl/lib/fts_.h b/gl/lib/fts_.h
|
||||
index d40a116..2e76cc4 100644
|
||||
--- a/gl/lib/fts_.h
|
||||
+++ b/gl/lib/fts_.h
|
||||
@@ -227,11 +227,6 @@ typedef struct _ftsent {
|
||||
|
||||
size_t fts_namelen; /* strlen(fts_name) */
|
||||
|
||||
- /* 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 */
|
||||
# define FTS_DEFAULT 3 /* none of the above */
|
||||
BIN
findutils-4.7.0.tar.xz
Normal file
BIN
findutils-4.7.0.tar.xz
Normal file
Binary file not shown.
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
Name: findutils
|
||||
Epoch: 2
|
||||
Version: 4.9.0
|
||||
Release: 1
|
||||
Version: 4.7.0
|
||||
Release: 7
|
||||
Summary: The GNU Find Utilities
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/findutils/
|
||||
@ -9,10 +9,12 @@ Source0: https://ftp.gnu.org/pub/gnu/findutils/%{name}-%{version}.tar.xz
|
||||
|
||||
# resolve test failures when ran as root
|
||||
# https://savannah.gnu.org/bugs/?57762
|
||||
Patch0: 0001-tests-avoid-FP-when-run-as-root.patch
|
||||
Patch1: 0001-findutils-xautofs.patch
|
||||
# rhbz #1252549 #1299169
|
||||
Patch2: 0001-findutils-leaf-opt.patch
|
||||
Buildrequires: gcc autoconf gettext-devel texinfo libselinux-devel dejagnu automake
|
||||
Patch3: 0004-fts-remove-NOSTAT_LEAF_OPTIMIZATION.patch
|
||||
Buildrequires: gcc autoconf gettext-devel texinfo libselinux-devel dejagnu automake gdb
|
||||
|
||||
Requires(post): info
|
||||
Requires(preun):info
|
||||
@ -94,33 +96,6 @@ fi
|
||||
%exclude %{_mandir}/man5/locatedb.5*
|
||||
|
||||
%changelog
|
||||
* Tue Oct 18 2022 dillon chen <dillon.chen@gmail.com> - 4.9.0-1
|
||||
- update to 4.9.0
|
||||
|
||||
* Thu Jun 16 2022 tanyulong <tanyulong@kylinos.cn> - 2:4.8.0-4
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Delete unnecessary gdb from BuildRequires
|
||||
|
||||
* Sat Feb 26 2022 shixuantong <shixuantong@h-partners.com> - 2:4.8.0-3
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:fix test_localeconv fail in aarch64 machine
|
||||
|
||||
* Tue Dec 21 2021 shixuantong <shixuantong@huawei.com> - 2:4.8.0-2
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:add -fsigned-char to %check
|
||||
|
||||
* Mon Aug 30 2021 shixuantong <shixuantong@huawei.com> - 2:4.8.0-1
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:update version to 4.8.0
|
||||
|
||||
* Fri Mar 19 2021 shixuantong <shixuantong@huawei.com> - 2:4.7.0-7
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user