On Mon, Sep 13, 2010 at 08:01:28PM +0100, Jason McIntyre wrote:
> On Mon, Sep 13, 2010 at 02:49:58PM +0200, Joachim Schipper wrote:
> > The first diff changes the last example in find(1). This diff:
> > (...)
> > - adds handling of *.gif files to illustrate ordering;
> 
> but we already have an example that does this:
> 
>       Print out a list of all the files which are not both newer than
>       ``ttt'' and owned by ``wnj'':
> 
>               $ find / \! \( -newer ttt -user wnj \)
> 
> i think that covers it well enough.

In the message to bugs@ that started this thread, djm@ got the ordering
of -o, specifically, wrong. I agree that the order of "and" is obvious,
but reasonable people can clearly believe that

        $ find . -name \*.jpg -o -name \*.gif -print0

will print both *.jpg and *.gif files.

> > - changes to -print0 | xargs -0r to illustrate proper form.
> 
> wouldn;t it be better to just use "find -X"? it is shorter, and the
> description of -X is probably the best place to start reading for most
> people.

find -X does solve some security problems, but only by erroring out. I
think -print0 is superior in every respect.

I agree that, in the current manpage, the description of -X is one of
the better places to point people.

> > The second diff is relative to the first diff, and adds the following
> > warning to CAVEATS:
> >     "Using find in combination with xargs(1) requires some care:
> > 
> >         $ find . -name \e*.jpg | xargs rm
> > 
> >     would, given a file *important\n.jpg* (where *\n* is a newline),
> >     remove *important*. Use the -print0 or -X flags, or use -exec
> >     instead."
> > 
> > This is already addressed in the man page (e.g. under the description of
> > -print0 or -X), but many people (including the EXAMPLES) get it wrong;
> > hopefully the above warning (and the references from the description of
> > -print and the EXAMPLES section) prevents some people from making this
> > mistake.
> 
> i don;t instinctively like this. if we document something correctly, we
> shouldn;t be adding in duplicate text just in case it gets missed. there
> is enough reading to do already, and what if the second text section is
> also ignored/not understood by the reader?
> 
> i'd prefer to just concentrate on saying something well, once.

There is merit in being concise, but:
- this should be under CAVEATS, no matter where else it appears (i.e. if
  you want to prevent duplication, remove it elsewhere);
- getting this wrong is a somewhat serious security problem, and tons of
  people get it wrong. Repeating it doesn't hurt.

                Joachim

Reply via email to