File findutils-xautofs.patch of Package findutils

---
 doc/find.texi  |    4 ++++
 find/defs.h    |    3 +++
 find/find.1    |    3 +++
 find/ftsfind.c |    6 ++++++
 find/parser.c  |   12 ++++++++++++
 find/util.c    |    4 +++-
 6 files changed, 31 insertions(+), 1 deletion(-)

Index: doc/find.texi
===================================================================
--- doc/find.texi.orig
+++ doc/find.texi
@@ -1608,6 +1608,10 @@ them.
 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
Index: find/defs.h
===================================================================
--- find/defs.h.orig
+++ find/defs.h
@@ -562,6 +562,9 @@ struct options
   /* 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.
    */
Index: find/find.1
===================================================================
--- find/find.1.orig
+++ find/find.1
@@ -638,6 +638,9 @@ to stat them; this gives a significant i
 .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.
 
Index: find/ftsfind.c
===================================================================
--- find/ftsfind.c.orig
+++ find/ftsfind.c
@@ -435,6 +435,12 @@ consider_visiting (FTS *p, FTSENT *ent)
 	}
     }
 
+  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 */
Index: find/parser.c
===================================================================
--- find/parser.c.orig
+++ find/parser.c
@@ -139,6 +139,7 @@ static bool parse_used          (const s
 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);
@@ -304,6 +305,7 @@ static struct parser_table const parse_t
   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.
@@ -2608,6 +2610,16 @@ parse_xdev (const struct parser_table* e
 }
 
 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;
Index: find/util.c
===================================================================
--- find/util.c.orig
+++ find/util.c
@@ -183,7 +183,8 @@ 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 -xdev -ignore_readdir_race -noignore_readdir_race\n\
+      -xautofs\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 +1029,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)
openSUSE Build Service is sponsored by