bugfindutils - Bugs: bug #56823, -regextype egrep compatibility...

 
 

bug #56823: -regextype egrep compatibility issue, requires full string match as opposed to egrep

Submitted by:  Isaac Freeman <memotype>
Submitted on:  Wed 28 Aug 2019 08:40:57 PM UTC  
 
Category:  find Severity:  2 - Minor
Item Group:  Wrong result Status:  Invalid
Privacy:  Public Assigned to:  James Youngman <jay>
Originator Name:  Open/Closed:  Open
Release:  4.6.0 Fixed Release:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 01 Sep 2019 07:31:27 AM UTC, comment #1: 

Well if we look at the "Finding Files" manual we see that -regex is described like this:

@deffn Test -regex expr
@deffnx Test -iregex expr
True if the entire file name matches regular expression @var{expr}.
This is a match on the whole path, not a search.  For example, to
[...]

Similarly, in the manual page:

-regex pattern
  File name matches regular expression pattern.  This is a match on the whole path, not a search.  For example, to
[...]

The description of the -regextype option specifically states that it affects only the regular expression syntax understood:

@deffn Option -regextype name
This option controls the variety of regular expression syntax
understood by the @samp{-regex} and @samp{-iregex} tests. 

The manpage is worded somewhat similarly:

-regextype type

  Changes  the  regular  expression  syntax  understood by -regex and -iregex tests which occur later on the command line.  To see which regular expression types are known, use -regextype help.  The Texinfo documentation (see SEE ALSO) explains the meaning of and differences between the various types of regular expression.

It's difficult then to see how such a confusion can arise.
If there is a specific change to the documentation that you think would avoid confusion, I'd be happy to consider a patch you'd like to send.

James Youngman <jay>
Project AdministratorIn charge of this item.
Wed 28 Aug 2019 08:40:57 PM UTC, original submission:  

$ find -version
find (GNU findutils) 4.6.0.225-235f
...

Issue: Running this

find . -regextype egrep -regex '\.ya?ml$'

finds nothing, while

find . | egrep '\.ya?ml$'

finds everything fine. Meanwhile

find . -regextype egrep -regex '.*\.ya?ml$'

works fine. I understand that find usually only matches the whole string, but it seems like it is misleading/confusing/unexpected that "-regextype egrep" isn't copy-and-paste-compatible with actual egrep.

Isaac Freeman <memotype>

 

(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 jay (Posted a comment)
  • -email is unavailable- added by memotype (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-01 jay Severity3 - Normal => 2 - Minor
        StatusNone => Invalid
        Assigned toNone => jay

    Back to the top


    Powered by Savane 3.7