bugfindutils - Bugs: bug #62255, find -iname *Word* and find -iname...

 
 

bug #62255: find -iname *Word* and find -iname *word* give different results

Submitter:  None
Submitted:  Mon 04 Apr 2022 10:13:54 PM UTC
 
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  Need Info
Privacy:  Public Assigned to:  berny
Originator Name:  ega Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  4.9.0
Fixed Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Sun 04 Sep 2022 04:44:20 PM UTC, comment #4: 

Hi: I was having the same problem, started debugging and then realized that it is just a matter of wildcard expansion within bash.

Meaning, if e.g. I have a file called 'compactfile.txt' and 'Compactfile2.file', and I do 'find -iname compact*', bash will expand 'compact*' to 'compactfile.txt' so the search will be very different to what you expect.

If you just put the search item within quotes or double quotes, it works.

Jacobo Pantoja <jacobopantoja>
Tue 05 Apr 2022 06:32:28 PM UTC, comment #3: 

The last try leads to the suspicion that the search failed
because the pattern was not quoted correctly.

$ touch {1..3}{w,W}ord{1..3}

$ ls
1Word1  1Word2  1Word3  1word1  1word2  1word3  2Word1  2Word2  2Word3  2word1  2word2  2word3  3Word1  3Word2  3Word3  3word1  3word2  3word3

$ find -iname *word*
find: paths must precede expression: `1word2'
find: possible unquoted pattern after predicate `-iname'?

# Show how find was really invoked.
$ echo find -iname *word*
find -iname 1word1 1word2 1word3 2word1 2word2 2word3 3word1 3word2 3word3

# Correctly quoted to prevent globbing by the shell.
$ find -iname '*word*' | wc -l
18

Is it that?

Bernhard Voelker <berny>
Project Administrator
Mon 04 Apr 2022 11:21:03 PM UTC, comment #2: 

changing compact for other words has various results
for example (aside from finding or not finding)

user@computer:~$ find -iname aword
find: paths must precede expression 'file name of one item'
find: possible unquoted pattern after predicate '-iname'?

Anonymous
Mon 04 Apr 2022 10:16:00 PM UTC, comment #1: 

it seems the wildcard in front and behind of compact turned it into bold

original submission:

> find (GNU findutils) 4.9.0
> Copyright (C) 2022 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> I was trying to find a file by name that contains the word: compact not sure if capitalized or not
>
> so I used
> user@computer:~$ find -iname compact
> and got one result, not the file I was looking for
>
> then I tried
> user@computer:~$ find -iname Compact
> and got 7 results including the previous one, my file was there
>
> (originally on 4.8 that comes preinstalled, installed 4.9.0 and got the same results)
>

Anonymous
Mon 04 Apr 2022 10:13:54 PM UTC, original submission:  

find (GNU findutils) 4.9.0
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I was trying to find a file by name that contains the word: compact not sure if capitalized or not

so I used
user@computer:~$ find -iname compact
and got one result, not the file I was looking for

then I tried
user@computer:~$ find -iname Compact
and got 7 results including the previous one, my file was there

(originally on 4.8 that comes preinstalled, installed 4.9.0 and got the same results)

Anonymous

 

(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 jacobopantoja (Posted a comment)
  • -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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-05 berny StatusNone Need Info
        Assigned toNone berny

    Back to the top

    Powered by Savane 3.10