bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #51711] non-helping error output with find


From: Bernhard Voelker
Subject: Re: [bug #51711] non-helping error output with find
Date: Thu, 10 Aug 2017 08:52:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 08/10/2017 01:12 AM, anonymous wrote:
> address@hidden ~/Downloads $ ls
> 2017-07-29_Entwurf-Berichtsteil-Lebensstile.pdf
> Ant Videos
> blockadesw.jpg
> blockbunt.jpg
> DSC1316.jpg
> faustklein.JPG
> fax.pdf
> notanugget.jpg
> todktter1.jpg
> todktter2.jpg
> Widerstand-gegen-Wiesenhof-Part-1.pdf
>
> address@hidden ~/Downloads $ LANG=C find . -name fax* bloc*
> find: paths must precede expression: blockadesw.jpg
> Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec]
> [path...] [expression]
> 
> This was, what I got by typing two patterns into find-command.

Sorry to say, but actually you did not pass 2 patterns to find.
Instead, you rather passed the 2 patterns to the shell which
globbed the file names before passing them to find(1).

With the above content of the directory (which is presumably
the output of 'ls -1' instead of the shown 'ls'), the shell
passed 3 arguments after the -name option; this can easily be
demonstrated by prepending the command line with 'echo':

  $ echo find . -name fax* block*
  find . -name fax.pdf blockadesw.jpg blockbunt.jpg
  ...

And find told you the offending part.

I have to admit that the file name is a little lost in the error
diagnostic.  IMO the file name should be quoted, and the "Usage"
text should be omitted.  With this, the actual error would be
more prominent:

  $ find . -name fax* block*
  find: paths must precede expression: `blockadesw.jpg'

The attached fixes it.  Comments?

Have a nice day,
Berny

Attachment: 0001-find-avoid-usage-in-more-error-cases.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]