[Top][All Lists]

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

[bug #60540] enable extended shell patterns for -name and -iname tests

From: Ian Bruce
Subject: [bug #60540] enable extended shell patterns for -name and -iname tests
Date: Thu, 6 May 2021 19:33:24 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0


                 Summary: enable extended shell patterns for -name and -iname
                 Project: findutils
            Submitted by: ian_bruce
            Submitted on: Thu 06 May 2021 11:33:22 PM UTC
                Category: find
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: None
         Discussion Lock: Any
           Fixed Release: None



The find(1) manual page states that for the "-name" test, "filename matching
is performed with the use of the fnmatch(3) library function."

Referring to the manual page for that function, the following flag is


    If this flag (a GNU extension) is set, extended patterns are supported, as
introduced by 'ksh' and now supported by other shells. The extended format is
as follows, with pattern-list being a '|' separated list of patterns.


    The pattern matches if exactly one occurrence of any of the patterns in
the pattern-list match the input string. 


However, it does not appear that this flag has been enabled for find(1) :

    $ ls
    videofile.avi  videofile.mkv  videofile.mp4  videofile.wmv

    $ ls *.@(mp4|avi)
    videofile.avi  videofile.mp4

    $ find . -name '*.@(mp4|avi)'
    [nothing found]

Please add this flag to the fnmatch() call, so that find(1) can produce the
same matches as the shell would. Presumably, no other code changes would be
required. Obviously, this flag should also be enabled for the "-iname" test.

If it is thought that enabling this functionality by default would be
undesirable for some reason, consider adding "-extname" and "-iextname" tests
which include it.

In any case, the find(1) manual page should be updated to explain whether or
not these extended shell patterns are supported.

Thank you.


Reply to this item at:


  Message sent via Savannah

reply via email to

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