bugfindutils - Bugs: bug #55272, wrong use of quotes in the error...

 
 

bug #55272: wrong use of quotes in the error message

Submitter:  Andreas Metzler <ametzler>
Submitted:  Sun 23 Dec 2018 03:18:41 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  berny
Originator Name:  Alexander E. Patrakov Open/Closed:  Closed
Release:  None Fixed Release:  4.7.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 08 Jan 2019 07:10:21 PM UTC, comment #5: 
Bernhard Voelker <berny>
Group administrator
Sat 05 Jan 2019 12:04:21 PM UTC, comment #4: 

Pushed a slightly different version (see attached patch) here:

https://git.sv.gnu.org/cgit/findutils.git/commit/?id=66174c10c6


$ find/find -name 'hello/world'
find/find: warning: '-name' matches against basenames only, \
but the given pattern contains a directory separator ('/'), \
thus the expression will evaluate to false all the time.  \
Did you mean '-wholename'?


Bernhard Voelker <berny>
Group administrator
Mon 24 Dec 2018 11:08:03 PM UTC, comment #3: 

oops, s/-path/-name/, of course:

- warning: '-path' matches against basenames, ...
+ warning: '-name' matches against basenames, ...

Bernhard Voelker <berny>
Group administrator
Mon 24 Dec 2018 04:41:47 PM UTC, comment #2: 


> find ... -print0 | grep -FzZ 'phc/*.tex'


That's wrong anyway, because -F means "fixed strings", i.e., no match against a regex pattern.

That whole warning is quite chatty IMO, and should be to the
documentation.  The warning should be more terse like e.g.:


warning: '-path' matches against basenames, did you mean '-wholename'?


... and similar for '-ipath' --> '-iwholename'.

Have a nice (Xmas) day,
Berny

Bernhard Voelker <berny>
Group administrator
Sun 23 Dec 2018 03:23:02 PM UTC, comment #1: 

grrr. savanah swallowed half of the bug-report. Rich-text without preview suck.

Anyway


find . -name phc/\*.tex

The output is:

find: warning: Unix filenames usually don't contain slashes (though
pathnames do).  That means that '-name `phc/*.tex'' will probably
evaluate to false all the time on this system.  You might find the
'-wholename' test more useful, or perhaps '-samefile'.  Alternatively,
if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ
`phc/*.tex''.

However, the backtick has special meaning in bash, and thus should be
replaced with a single quote in the second and the last lines of the
error message. I.e., the error message should suggest to run

find ... -print0 | grep -FzZ 'phc/*.tex'



How about using quoting_style = c_quoting_style?

Andreas Metzler <ametzler>
Sun 23 Dec 2018 03:18:41 PM UTC, original submission:  

Hello,

this was submitted in the Debian BTS as https://bugs.debian.org/487496



find . -name phc/\*.tex

The output is:

find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name `phc/*.tex'' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ `phc/*.tex''.
-verbatim
However, the backtick has special meaning in bash, and thus should be replaced with a single quote in the second and the last lines of the error message. I.e., the error message should suggest to run
+verbatim+
find ... -print0 | grep -FzZ 'phc/*.tex'




With e.g. en_US.UTF-8 Unicode quotes are used but wouldn't it be better to use quotes understood by shell?

I originally thought this was some gettext magic, but the cause is quoting_style = locale_quoting_style. How about using c_quoting_style instead?

Andreas Metzler <ametzler>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #45874:  0001-find-improve-warning-diagnostic-for-the-name-iname-w.patch added by berny (3KiB - text/x-patch - [PATCH] find: improve warning diagnostic for the -name/-iname with '/' in pattern)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  • -email is unavailable- added by berny (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-08-29 jay Open/ClosedOpen Closed
    2019-08-29 berny Fixed ReleaseNone 4.7.0
    2019-01-05 berny CategoryNone find
    2019-01-05 berny StatusNone Fixed
    2019-01-05 berny Attached File- Added 0001-find-improve-warning-diagnostic-for-the-name-iname-w.patch, #45874
    2018-12-24 berny Assigned toNone berny
    2018-12-23 ametzler Carbon-CopyRemoved 20807 -

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code