bugfindutils - Bugs: bug #26217, argument parsing bug with -regex...

 
 

bug #26217: argument parsing bug with -regex .... \; without preceding -exec

Submitted by:  None
Submitted on:  Fri 17 Apr 2009 09:07:10 PM UTC  
 
Category: findSeverity: 3 - Normal
Item Group: Wrong resultStatus: Invalid
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: dan prittsOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.4.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.

 

Wed 31 Mar 2010 07:42:24 AM UTC, comment #4:

The error message is different in 4.5.6b

$ ./find/find /home/mysql/olddbroots -ls ';'
./find/find: paths must precede expression: ;
Usage: ./find/find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

James Youngman <jay>
Project AdministratorIn charge of this item.
Mon 20 Apr 2009 06:04:36 PM UTC, comment #3:

It's probably sufficiently useful to change the existing error message to display the unexpected extra argument.

James Youngman <jay>
Project AdministratorIn charge of this item.
Mon 20 Apr 2009 01:39:31 PM UTC, comment #2:

Damn, I knew I must be doing something dumb, sorry.

Now that I know what it means, the error message is clear, but the eye just skipped past the : ; combo.

Might I suggest a special-case error message when an unnecessary trailing ; is encountered?

thanks!

dan pritts <danpritts>
Fri 17 Apr 2009 10:43:53 PM UTC, comment #1:

Thanks for the detailed bug report. However, many of the options you used make no difference to the problem. You can reduce it to this case:

$ find /home/mysql/olddbroots -ls ';'
find: paths must precede expression: ;
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

The problem is that the directory/file start points need to be specified before the tests on the command line. Since ";" does not begin with "-" it is assumed to be a start point rather than a test, but start points don't belong at that position in the command line. In other words, just remove the \;. The only reason you need to use \; in the -exec case is that the \; marks the end of the arguments to -exec.

James Youngman <jay>
Project AdministratorIn charge of this item.
Fri 17 Apr 2009 09:07:10 PM UTC, original submission:

Apologies if this is some sort of stupidity on my part but I've poked at this and read the docs a bunch.

my os is RHEL5, 32-bit x86. I've built my own findutils 4.4.0 to confirm it's not just in RHEL's find.

Consider these two commands; they should be the same other than the final line.

Here's what I get when i execute the script that contins them:

[empty result is expected]

[error message is not expected]

in general, if i give -exec, the command succeeds; if i try -print or -ls or just leave it out, it fails.

The directory i'm specifying (/home/mysql/olddbroots) does exist.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by danpritts (Posted a comment)
  • -unavailable- added by jay (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 31 Mar 2010 07:42:24 AM UTCjayAssigned toNone=>jay
      Open/ClosedOpen=>Closed
      Summaryargument parsing bug with -regex .... \\; without preceding -exec=>argument parsing bug with -regex .... \; without preceding -exec
    Mon 20 Apr 2009 06:04:36 PM UTCjaySummaryargument parsing bug with -regex .... \\; without preceding -exec=>argument parsing bug with -regex .... \; without preceding -exec
    Fri 17 Apr 2009 10:43:53 PM UTCjayStatusNone=>Invalid
      Summaryargument parsing bug with -regex=>argument parsing bug with -regex .... \; without preceding -exec

    Back to the top


    Powered by Savane 3.1-cleanup1