buggrep - Bugs: bug #10537, Reassigned item: grep -r should...

 
 

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

bug #10537: Reassigned item: grep -r should warn if no filenames are given

Submitted by:  Tim Waugh <twaugh>
Submitted on:  Thu 30 Sep 2004 08:27:25 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Wont Fix
Privacy: PublicAssigned to: None
Open/Closed: Closed

Thu 30 Sep 2004 09:29:07 AM UTC, comment #2:

The proposed solution is not right.
-r alias alias -R --recurse is equivalent to --directories=recurse.
Any of these forms can be used in env. var GREP_OPTIONS.

If -r (or an equivalent) is set in GREP_OPTIONS, it's not a mistake when grep is then run without parameters.

One possibility would be to distinguinsh whether the option was given on cmdline or via GREP_OPTIONS. But I don't think it's the right solution.

And what if someone defines an alias for ``grep --directories=recurse''? That seems natural, doesn't it?

I think it would have been better if -r wasn't defined as
an equivalent for --directories=recurse. -r should have been defined to imply --directories=recurse and something more. That ``something more'' could have been your warning, or it could have been that the default is ``.'' (current dir), not stdin.

My current opinion is that future versions of grep should have an option, say --default-to-curdir, which would be defined as follows:
when this oprion is on, -r, -R, and --recurse not only imply --directories=recurse, but also immply that when no parameters are given, grep searches recursively the current directory.

Anyone could then put
GREP_OPTIONS=--default-to-curdir; export GREP_OPTIONS
to his .profile.

I also contemplated breaking the backward compatibility and implementing this permanently, but it's probably not worth it.

Hope you'll like this solution.

Stepan Kasal <kasal>
Project Member
Thu 30 Sep 2004 08:27:25 AM UTC, comment #1:

This item has been reassigned from the project grep patch tracker to your tracker.

The original report is still available at patch #3393

Following are the information included in the original report:

[field #0] Item ID:  3393
[field #1] Group ID:  67
[field #2] Status:  Open
[field #3] Severity:  5 - Average
[field #4] Privacy:  Public
[field #5] Category:  None
[field #6] Submitted by:  twaugh
[field #7] Assigned to:  None
[field #8] Submitted on:  Mon 09/27/2004 at 17:12
[field #9] Summary:  grep -r should warn if no filenames are given
[field #10] Original Submission:  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=132651 />


Since reading stdin makes no sense with the -r flag, perhaps a filename argument should be required when -r is given.
[field #12] Item Group:  None
[field #13] Resolution:  None
[field #14] Component Version:  None
[field #15] Platform Version:  None
[field #16] Reproducibility:  None
[field #17] Size (loc):  None
[field #18] Fixed Release:  None
[field #19] Planned Release:  None
[field #20] Effort:  0.00
[field #24] Priority:  1 - Later
[field #27] Percent Complete:  0%
[field #29] Release:  None
[field #54] Custom Select Box #1:  None
[field #55] Custom Select Box #2:  None
[field #56] Custom Select Box #3:  None
[field #57] Custom Select Box #4:  None
[field #58] Custom Select Box #5:  None
[field #59] Custom Select Box #6:  None
[field #60] Custom Select Box #7:  None
[field #61] Custom Select Box #8:  None
[field #62] Custom Select Box #9:  None
[field #63] Custom Select Box #10:  None

Stepan Kasal <kasal>
Project Member
Thu 30 Sep 2004 08:27:25 AM UTC, original submission:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=132651

Since reading stdin makes no sense with the -r flag, perhaps a filename argument should be required when -r is given.

Tim Waugh <twaugh>

 

Attached Files
file #1818:  grep-2.5.1-error_no_filename.patch added by twaugh (613B - application/octet-stream - grep-2.5.1-error_no_filename.patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 30 Sep 2004 09:29:07 AM UTCkasalStatusNone=>Wont Fix
  Open/ClosedOpen=>Closed
Thu 30 Sep 2004 08:27:25 AM UTCkasalReassign itemFrom group grep, patch tracker=>To group grep, bugs tracker

Back to the top


Powered by Savane 3.1-cleanup1