3
0
forked from pool/findutils
findutils/findutils-4.4.2-xautofs.patch

104 lines
4.2 KiB
Diff

diff -aur findutils-4.5.10.orig/doc/find.texi findutils-4.5.10/doc/find.texi
--- findutils-4.5.10.orig/doc/find.texi 2012-01-16 15:29:59.649039029 -0500
+++ findutils-4.5.10/doc/find.texi 2012-01-16 15:54:30.683648566 -0500
@@ -1440,6 +1440,10 @@
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 -aur findutils-4.5.10.orig/find/defs.h findutils-4.5.10/find/defs.h
--- findutils-4.5.10.orig/find/defs.h 2011-04-03 18:53:11.000000000 -0400
+++ findutils-4.5.10/find/defs.h 2012-01-16 15:56:13.473363517 -0500
@@ -561,6 +561,9 @@
/* If true, don't cross filesystem boundaries. */
bool stay_on_filesystem;
+ /* If true, don't descend directores 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 -aur findutils-4.5.10.orig/find/find.1 findutils-4.5.10/find/find.1
--- findutils-4.5.10.orig/find/find.1 2011-04-03 18:53:11.000000000 -0400
+++ findutils-4.5.10/find/find.1 2012-01-16 15:57:07.003694295 -0500
@@ -460,6 +460,9 @@
.B \-nowarn
otherwise.
+.IP \-xautofs
+Don't descend directories on autofs filesystems.
+
.IP \-xdev
Don't descend directories on other filesystems.
diff -aur findutils-4.5.10.orig/find/ftsfind.c findutils-4.5.10/find/ftsfind.c
--- findutils-4.5.10.orig/find/ftsfind.c 2011-04-03 18:53:11.000000000 -0400
+++ findutils-4.5.10/find/ftsfind.c 2012-01-16 16:00:05.103467741 -0500
@@ -485,6 +485,12 @@
}
}
+ if (options.bypass_autofs &&
+ 0 == strcmp ("autofs", filesystem_type (&statbuf, ent->fts_name)))
+ {
+ 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 -aur findutils-4.5.10.orig/find/parser.c findutils-4.5.10/find/parser.c
--- findutils-4.5.10.orig/find/parser.c 2011-04-03 18:53:11.000000000 -0400
+++ findutils-4.5.10/find/parser.c 2012-01-16 16:05:32.208378367 -0500
@@ -151,6 +151,7 @@
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_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);
@@ -325,6 +326,7 @@
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+ */
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.
@@ -2800,6 +2802,16 @@
}
static bool
+parse_xautofs(const struct parser_table* entry, char **argv, int *arg_ptr)
+{
+ (void) argv;
+ (void) arg_ptr;
+ (void) entry;
+ options.bypass_autofs = true;
+ return true;
+}
+
+static bool
parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr)
{
options.ignore_readdir_race = true;
diff -aur findutils-4.5.10.orig/find/util.c findutils-4.5.10/find/util.c
--- findutils-4.5.10.orig/find/util.c 2011-04-03 18:53:11.000000000 -0400
+++ findutils-4.5.10/find/util.c 2012-01-16 16:06:17.309814520 -0500
@@ -1006,6 +1006,7 @@
p->full_days = false;
p->stay_on_filesystem = false;
+ p->bypass_autofs = false;
p->ignore_readdir_race = false;
if (p->posixly_correct)