bugfindutils - Bugs: bug #58170, find . -name "ba*.tmp"...

 
 

bug #58170: find . -name "ba*.tmp" fails if more than 1 match (windows 10)

Submitter:  Jim Cant <jimcant>
Submitted:  Mon 13 Apr 2020 04:17:41 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  Working as Intended
Privacy:  Public Assigned to:  berny
Originator Name:  Jim Cant Open/Closed:  Closed
Release:  4.2.20 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 13 Apr 2020 05:27:41 PM UTC, comment #1: 

I can reproduce on Windows 10 in a Powershell window, but I can
not reproduce in a regular CMD window.

Reading about Powershell quoting rules, it seems that it still
evaluates "*" wildcards in single or double quotes.
https://ss64.com/ps/syntax-esc.html

Thus, find does not see the glob pattern you intended to pass,
but immediately the evaluated result of the wildcard matching
of the Powershell.
Therefore, this does not seem to be a bug in find, but more
a question in the calling shell, the Powershell.

Bernhard Voelker <berny>
Group administrator
Mon 13 Apr 2020 04:17:41 PM UTC, original submission:  

This is on Windows 10.  If the file pattern matches more than one file, the search fails with a 'paths must precede expression' message.  Happens if patter is not quoted, single quote, or double quoted.  (It is as if the pattern is getting expanded as on Unix when not quoted.)

Here's is screen shot of several commands that illustrate the issue:  when trying various matchs with wildcards against 3 files, the only ones that work are when a pattern matches only one file.

T:\>ls b*.tmp
bag.tmp   bat.tmp   bug.tmp

T:\>find . -name "bu*.tmp"
./bug.tmp

T:\>find . -name "ba*.tmp"
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

T:\>find . -name "bag*.tmp"
./bag.tmp

T:\>find . -name bag*.tmp -o -name bat*.tmp
./bag.tmp
./bat.tmp

T:\>find . -name bag*.tmp bat*.tmp
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

Jim Cant <jimcant>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-04-23 berny Open/ClosedOpen Closed
    2020-04-13 berny StatusNone Working as Intended
        Assigned toNone berny
    2020-04-13 jimcant Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code