Date: Thu, 8 Mar 2018 12:23:16 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Bruce Evans <brde@optusnet.com.au> Cc: Ian Lepore <ian@freebsd.org>, Bryan Drewery <bdrewery@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330436 - head/bin/chflags Message-ID: <20180308120343.E2426@besplex.bde.org> In-Reply-To: <20180305140228.P935@besplex.bde.org> References: <201803050156.w251u7Y8020941@repo.freebsd.org> <1520215860.38056.3.camel@freebsd.org> <20180305140228.P935@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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: >>> >>> Log: >>> \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). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180308120343.E2426>