buggrep - Bugs: bug #39706, Does not return filename if only...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #39706: Does not return filename if only one file matches pattern

Submitter:  None
Submitted:  Tue 06 Aug 2013 02:14:18 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Tue 06 Aug 2013 03:06:14 PM UTC, comment #4: 

Thanks for the clarification on this and Closing the report.

Alasdair Campbell <alasdair>
Tue 06 Aug 2013 02:24:20 PM UTC, comment #3: 

Or you can use the option -H to ensure that the file name is printed.

(This option is not defined by posix.)

Stepan Kasal <kasal>
Group Member
Tue 06 Aug 2013 02:19:40 PM UTC, comment #2: 
Eric Blake <ericb>
Group Member
Tue 06 Aug 2013 02:17:27 PM UTC, comment #1: 

Not a bug; this behavior is required by POSIX.  That's why you'll often find recipes such as:

xargs grep $pattern /dev/null

which combines /dev/null (which will never match) along with your list (possible one file long) from xargs, so that grep sees at least two files, and starts listing file names.

Eric Blake <ericb>
Group Member
Tue 06 Aug 2013 02:14:18 PM UTC, original submission:  

If I run grep without the -r flag looking for a string (Incomplete in this case but it doesn't matter) using the string /.php for the files argument and only one file matches this pattern grep does not return the file name as part of the search.

Example:
grep Incomplete /.php

Expected:
path/filename.php: $this->markTestIncomplete();

Actual:
$this->markTestIncomplete();

Anonymous

 

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

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 alasdair (Posted a comment)
  • -email is unavailable- added by kasal (Posted a comment)
  • -email is unavailable- added by ericb (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.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-08-06 ericb StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code