Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Apr 2012 17:30:20 GMT
From:      Richard Kettlewell <rjk@greenend.org.uk>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/166553: find -delete documentation is misleading
Message-ID:  <201204011730.q31HUKR2028319@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/166553; it has been noted by GNATS.

From: Richard Kettlewell <rjk@greenend.org.uk>
To: Matthew Story <matthewstory@gmail.com>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/166553: find -delete documentation is misleading
Date: Sun, 01 Apr 2012 18:25:55 +0100

 On 01/04/2012 18:24, Matthew Story wrote:
 > On Sun, Apr 1, 2012 at 5:24 AM, Richard Kettlewell<rjk@greenend.org.uk>  wrote:
 >>
 >> The documentation for 'find -delete' includes the following remark:
 >>
 >>     It will not attempt to delete a filename with a “/” character in its pathname relative to “.” for security reasons.
 >>
 >> This reflects a defensive test early in f_delete. However, the test will not succeed, since find does not use FTS_NOCHDIR, so entry->fts_accpath should never contain "/".
 >
 > $ # show test succeeds
 > $ mkdir -p foo/bar/baz
 > $ find ./foo -delete
 > find: -delete: ./foo: relative path potentially not safe
 >
 > The reason that fts_accpath contains a leading ``./'' in this case is
 > that fts, even without FTS_NOCHDIR, does not chdir into the parent
 > directory of depth 0 directories on the first pass, fts_accpath will
 > always equal fts_pathname on depth 0 FTSENTs.
 
 Light dawns l-)
 
 Still, the wording could be improved: it doesn't really describe well 
 when -delete will succeed and when it won't.
 
 ttfn/rjk



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204011730.q31HUKR2028319>