On Mon, 5 Mar 2018, Bruce Evans wrote:

On Sun, 4 Mar 2018, Ian Lepore wrote:

On Mon, 2018-03-05 at 01:56 +0000, Bryan Drewery wrote:

\xa0 chflags: Add -x option to not traverse mount points.

Yay! \xa0One day later than I needed it, but still, yay!

I recently noticed that find(1) needs an option to not look at mount
points at all, and further options to classify mount points so that
you can prune them.

After reading the above and investigating further, I noticed that -x
is broken in most FreeBSD utilities, since POSIX requires not looking
at mount points at all for the few utilities that support -x.  E.g.,
for du in 2001 draft 7 POSIX:

This seems to be easy to fix by by skipping in callers of fts_read().
Fix for an old version of du:

XX Index: du.c
XX ===================================================================
XX RCS file: /home/ncvs/src/usr.bin/du/du.c,v
XX retrieving revision 1.34
XX diff -u -2 -r1.34 du.c
XX --- du.c     2 Jun 2004 07:09:34 -0000       1.34
XX +++ du.c     8 Mar 2018 00:57:12 -0000
XX @@ -86,9 +86,11 @@
XX      int             listall;
XX      int             depth;
XX -    int             Hflag, Lflag, Pflag, aflag, sflag, dflag, cflag, hflag, 
ch, notused, rval;
XX +    int             Hflag, Lflag, Pflag, aflag, sflag, dflag, cflag, hflag;
XX +    int             xflag, ch, notused, rval;
XX      char            **save;
XX      static char     dot[] = ".";
XX XX Hflag = Lflag = Pflag = aflag = sflag = dflag = cflag = hflag = 0;
XX +    xflag = 0;
XX XX save = argv;
XX @@ -148,4 +150,5 @@
XX                              break;
XX                      case 'x':
XX +                            xflag = 1;
XX                              ftsoptions |= FTS_XDEV;
XX                              break;
XX @@ -219,4 +222,7 @@
XX                              break;
XX                      case FTS_DP:
XX +                            if (xflag && p->fts_statp->st_dev !=
XX +                                p->fts_parent->fts_statp->st_dev)
XX +                                    break;
XX                              if (ignorep(p))
XX                                      break;

This patch won't apply cleanly in -current because -current has large
changes in all areas touched by the patch (mainly to undo formatting
away from KNF).

svn-src-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to