From owner-svn-src-head@freebsd.org Thu Mar 8 01:23:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 136B7F45DA2; Thu, 8 Mar 2018 01:23:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 82E5B7B1C2; Thu, 8 Mar 2018 01:23:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.101] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 31FE4D4408C; Thu, 8 Mar 2018 12:23:17 +1100 (AEDT) Date: Thu, 8 Mar 2018 12:23:16 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Ian Lepore , Bryan Drewery , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330436 - head/bin/chflags In-Reply-To: <20180305140228.P935@besplex.bde.org> Message-ID: <20180308120343.E2426@besplex.bde.org> References: <201803050156.w251u7Y8020941@repo.freebsd.org> <1520215860.38056.3.camel@freebsd.org> <20180305140228.P935@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=4gYfcDbAvbXn5vcoyysA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2018 01:23:27 -0000 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