2024-11-12 10:57:54 +00:00
|
|
|
From cd653102f401f91748c3f038be4d38ddacc2d7db Mon Sep 17 00:00:00 2001
|
2022-05-17 10:37:27 +00:00
|
|
|
From: Kamil Dudka <kdudka@redhat.com>
|
2024-11-12 10:57:54 +00:00
|
|
|
Date: Wed, 3 Jul 2024 10:22:49 +0200
|
2022-05-17 10:37:27 +00:00
|
|
|
Subject: [PATCH] findutils-4.4.2-xautofs.patch
|
|
|
|
|
|
|
|
---
|
2024-11-12 10:57:54 +00:00
|
|
|
doc/find.texi | 4 ++++
|
|
|
|
find/defs.h | 3 +++
|
|
|
|
find/find.1 | 3 +++
|
|
|
|
find/ftsfind.c | 11 +++++++++--
|
|
|
|
find/parser.c | 9 +++++++++
|
|
|
|
find/util.c | 3 ++-
|
|
|
|
6 files changed, 30 insertions(+), 3 deletions(-)
|
2022-05-17 10:37:27 +00:00
|
|
|
|
|
|
|
diff --git a/doc/find.texi b/doc/find.texi
|
2024-11-12 10:57:54 +00:00
|
|
|
index f31f8d1..b2e5fc5 100644
|
2022-05-17 10:37:27 +00:00
|
|
|
--- a/doc/find.texi
|
|
|
|
+++ b/doc/find.texi
|
2024-11-12 10:57:54 +00:00
|
|
|
@@ -1517,6 +1517,10 @@ them.
|
2022-05-17 10:37:27 +00:00
|
|
|
There are two ways to avoid searching certain filesystems. One way is
|
|
|
|
to tell @code{find} to only search one filesystem:
|
|
|
|
|
|
|
|
+@deffn Option -xautofs
|
|
|
|
+Don't descend directories on autofs filesystems.
|
|
|
|
+@end deffn
|
|
|
|
+
|
|
|
|
@deffn Option -xdev
|
|
|
|
@deffnx Option -mount
|
|
|
|
Don't descend directories on other filesystems. These options are
|
|
|
|
diff --git a/find/defs.h b/find/defs.h
|
2024-11-12 10:57:54 +00:00
|
|
|
index 72048ff..adb5973 100644
|
2022-05-17 10:37:27 +00:00
|
|
|
--- a/find/defs.h
|
|
|
|
+++ b/find/defs.h
|
|
|
|
@@ -574,6 +574,9 @@ struct options
|
|
|
|
/* If true, don't cross filesystem boundaries. */
|
|
|
|
bool stay_on_filesystem;
|
|
|
|
|
|
|
|
+ /* If true, don't descend directories on autofs filesystems. */
|
|
|
|
+ bool bypass_autofs;
|
|
|
|
+
|
|
|
|
/* If true, we ignore the problem where we find that a directory entry
|
|
|
|
* no longer exists by the time we get around to processing it.
|
|
|
|
*/
|
|
|
|
diff --git a/find/find.1 b/find/find.1
|
2024-11-12 10:57:54 +00:00
|
|
|
index a536106..b8cf1fb 100644
|
2022-05-17 10:37:27 +00:00
|
|
|
--- a/find/find.1
|
|
|
|
+++ b/find/find.1
|
2024-11-12 10:57:54 +00:00
|
|
|
@@ -576,6 +576,9 @@ to stat them; this gives a significant increase in search speed.
|
2022-05-17 10:37:27 +00:00
|
|
|
.IP "\-version, \-\-version"
|
|
|
|
Print the \fBfind\fR version number and exit.
|
|
|
|
|
|
|
|
+.IP \-xautofs
|
|
|
|
+Don't descend directories on autofs filesystems.
|
|
|
|
+
|
|
|
|
.IP \-xdev
|
|
|
|
Don't descend directories on other filesystems.
|
|
|
|
|
|
|
|
diff --git a/find/ftsfind.c b/find/ftsfind.c
|
2024-11-12 10:57:54 +00:00
|
|
|
index 109f23a..5c4c2e2 100644
|
2022-05-17 10:37:27 +00:00
|
|
|
--- a/find/ftsfind.c
|
|
|
|
+++ b/find/ftsfind.c
|
2024-11-12 10:57:54 +00:00
|
|
|
@@ -267,8 +267,8 @@ symlink_loop (const char *name)
|
|
|
|
static void
|
|
|
|
consider_visiting (FTS *p, FTSENT *ent)
|
|
|
|
{
|
|
|
|
- struct stat statbuf;
|
|
|
|
- mode_t mode;
|
|
|
|
+ struct stat statbuf = {0};
|
|
|
|
+ mode_t mode = 0;
|
|
|
|
int ignore, isdir;
|
|
|
|
|
|
|
|
if (options.debug_options & DebugSearch)
|
|
|
|
@@ -432,6 +432,13 @@ consider_visiting (FTS *p, FTSENT *ent)
|
2022-05-17 10:37:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-12 10:57:54 +00:00
|
|
|
+ if (options.bypass_autofs
|
|
|
|
+ && 0 == get_statinfo (ent->fts_path, ent->fts_name, &statbuf)
|
|
|
|
+ && 0 == strcmp ("autofs", filesystem_type (&statbuf, ent->fts_name)))
|
2022-05-17 10:37:27 +00:00
|
|
|
+ {
|
|
|
|
+ fts_set(p, ent, FTS_SKIP); /* descend no further */
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if ( (ent->fts_info == FTS_D) && !options.do_dir_first )
|
|
|
|
{
|
|
|
|
/* this is the preorder visit, but user said -depth */
|
|
|
|
diff --git a/find/parser.c b/find/parser.c
|
2024-11-12 10:57:54 +00:00
|
|
|
index 8546982..3d42efc 100644
|
2022-05-17 10:37:27 +00:00
|
|
|
--- a/find/parser.c
|
|
|
|
+++ b/find/parser.c
|
|
|
|
@@ -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);
|
|
|
|
+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_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[] =
|
|
|
|
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 */
|
|
|
|
+ PARSE_OPTION ("xautofs", xautofs),
|
|
|
|
PARSE_TEST ("xtype", xtype), /* GNU */
|
|
|
|
#ifdef UNIMPLEMENTED_UNIX
|
|
|
|
/* It's pretty ugly for find to know about archive formats.
|
2024-11-12 10:57:54 +00:00
|
|
|
@@ -2594,6 +2596,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
|
2022-05-17 10:37:27 +00:00
|
|
|
return parse_noop (entry, argv, arg_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
+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
|
|
|
|
parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr)
|
|
|
|
{
|
|
|
|
diff --git a/find/util.c b/find/util.c
|
2024-11-12 10:57:54 +00:00
|
|
|
index 959272a..e7d174e 100644
|
2022-05-17 10:37:27 +00:00
|
|
|
--- 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)
|
|
|
|
|
|
|
|
p->full_days = false;
|
|
|
|
p->stay_on_filesystem = false;
|
|
|
|
+ p->bypass_autofs = false;
|
|
|
|
p->ignore_readdir_race = false;
|
|
|
|
|
|
|
|
if (p->posixly_correct)
|
|
|
|
--
|
2024-11-12 10:57:54 +00:00
|
|
|
2.45.2
|
2022-05-17 10:37:27 +00:00
|
|
|
|