update to 4.9.0

This commit is contained in:
dillon_chen 2022-10-18 12:51:26 +08:00
parent 74fad0c78a
commit 7c5ece92b4
5 changed files with 126 additions and 76 deletions

View File

@ -1,34 +1,60 @@
From 79962cf9eecbf5e67e195f48aa5ab890fbed9250 Mon Sep 17 00:00:00 2001
From 547e7145f335dc07144f35eaacc520475068852e Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 13 Feb 2020 09:59:09 +0800
Subject: [PATCH] findutils leaf opt
Date: Fri, 30 Aug 2019 10:22:22 +0200
Subject: [PATCH 1/3] Revert "fts: cleanup after FTS_NOATIME removal"
This reverts commit dce8759f0f0236a860a3e68b63c5e99cc6f168f9.
---
find/ftsfind.c | 3 +++
gl/lib/fts.c | 4 ++++
gl/lib/fts_.h | 16 ++++++++++++----
3 files changed, 19 insertions(+), 4 deletions(-)
gl/lib/fts_.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
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;
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
+ if (options.no_leaf_check)
+ ftsoptions |= FTS_NOLEAF;
+/* 0x0800 unused, was non-working FTS_NOATIME */
+
p = fts_open (arglist, ftsoptions, NULL);
if (NULL == p)
{
/* 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(-)
diff --git a/gl/lib/fts.c b/gl/lib/fts.c
index 8b7a4de..1093ce5 100644
index d2d404f..808466f 100644
--- a/gl/lib/fts.c
+++ b/gl/lib/fts.c
@@ -713,6 +713,10 @@ filesystem_type (FTSENT const *p, int fd)
@@ -706,6 +706,10 @@ filesystem_type (FTSENT const *p, int fd)
struct dev_type *ent;
struct statfs fs_buf;
@ -40,36 +66,57 @@ index 8b7a4de..1093ce5 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 fb5558f..d40a116 100644
index 63d4b74..f1d519b 100644
--- a/gl/lib/fts_.h
+++ b/gl/lib/fts_.h
@@ -149,14 +149,22 @@ 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
@@ -155,10 +155,16 @@ typedef struct {
from input path names during fts_open initialization. */
-# define FTS_VERBATIM 0x0800
+# define FTS_VERBATIM 0x1000
+
# define FTS_VERBATIM 0x1000
-# define FTS_OPTIONMASK 0x1fff /* valid user option mask */
+ /* 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_OPTIONMASK 0x0fff /* valid user option mask */
-# define FTS_NAMEONLY 0x2000 /* (private) child names only */
-# define FTS_STOP 0x4000 /* (private) unrecoverable error */
+# 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
--
1.8.3.1
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

View File

@ -1,22 +1,22 @@
From 96c16e761f5a60b29197181400fa2a8e3603ebf9 Mon Sep 17 00:00:00 2001
From 17e470dc1acca4824b70328d733d5f99c12d0d65 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 13 Feb 2020 09:49:30 +0800
Subject: [PATCH] findutils xautofs
Date: Wed, 11 May 2011 16:46:45 +0200
Subject: [PATCH] findutils-4.4.2-xautofs.patch
---
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(-)
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(-)
diff --git a/doc/find.texi b/doc/find.texi
index a410b29..42a4257 100644
index c584298..9731b71 100644
--- a/doc/find.texi
+++ b/doc/find.texi
@@ -1475,6 +1475,10 @@ them.
@@ -1606,6 +1606,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 a410b29..42a4257 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 9b5e506..c0a0bba 100644
index 11d1d00..f95ce72 100644
--- a/find/defs.h
+++ b/find/defs.h
@@ -574,6 +574,9 @@ struct options
@@ -562,6 +562,9 @@ struct options
/* If true, don't cross filesystem boundaries. */
bool stay_on_filesystem;
@ -42,10 +42,10 @@ index 9b5e506..c0a0bba 100644
* no longer exists by the time we get around to processing it.
*/
diff --git a/find/find.1 b/find/find.1
index bcc1b32..7f4a733 100644
index e851f82..a4799ff 100644
--- a/find/find.1
+++ b/find/find.1
@@ -567,6 +567,9 @@ to stat them; this gives a significant increase in search speed.
@@ -638,6 +638,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 bcc1b32..7f4a733 100644
Don't descend directories on other filesystems.
diff --git a/find/ftsfind.c b/find/ftsfind.c
index 0d96c4c..69a3d8d 100644
index 9fdb8ef..bd7cc37 100644
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -479,6 +479,12 @@ consider_visiting (FTS *p, FTSENT *ent)
@@ -435,6 +435,12 @@ consider_visiting (FTS *p, FTSENT *ent)
}
}
@ -73,10 +73,10 @@ index 0d96c4c..69a3d8d 100644
{
/* this is the preorder visit, but user said -depth */
diff --git a/find/parser.c b/find/parser.c
index 5770487..8c66b0a 100644
index 52a1ef6..995aec3 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -138,6 +138,7 @@ static bool parse_used (const struct parser_table*, char *argv[], int *
@@ -139,6 +139,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 5770487..8c66b0a 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);
@@ -302,6 +303,7 @@ static struct parser_table const parse_table[] =
@@ -304,6 +305,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 5770487..8c66b0a 100644
PARSE_TEST ("xtype", xtype), /* GNU */
#ifdef UNIMPLEMENTED_UNIX
/* It's pretty ugly for find to know about archive formats.
@@ -2604,6 +2606,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
@@ -2607,6 +2609,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
return parse_noop (entry, argv, 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 aa387a4..a10f169 100644
index 8577396..4d45f84 100644
--- a/find/util.c
+++ b/find/util.c
@@ -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)
@@ -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)
p->full_days = false;
p->stay_on_filesystem = false;
@ -128,5 +128,5 @@ index aa387a4..a10f169 100644
if (p->posixly_correct)
--
1.8.3.1
1.7.4.4

Binary file not shown.

BIN
findutils-4.9.0.tar.xz Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
Name: findutils
Epoch: 2
Version: 4.8.0
Release: 4
Version: 4.9.0
Release: 1
Summary: The GNU Find Utilities
License: GPLv3+
URL: http://www.gnu.org/software/findutils/
@ -94,6 +94,9 @@ 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