buggrep - Bugs: bug #29551, [ENH] grep listens in vain forever...

 
 

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

bug #29551: [ENH] grep listens in vain forever on STDIN even if -r flag (and no file) is supplied

Submitter:  Torge Husfeldt <torgehusfeldt>
Submitted:  Wed 14 Apr 2010 11:24:43 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Duplicate
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Thu 15 Apr 2010 07:35:23 AM UTC, comment #4: 

You can follow the instructions at http://git.savannah.gnu.org/cgit/grep.git/tree/HACKING

Paolo Bonzini <bonzini>
Thu 15 Apr 2010 07:26:30 AM UTC, comment #3: 

Sorry for bothering,
I just found the relevant references myself.

https://savannah.gnu.org/bugs/index.php?25197

Torge Husfeldt <torgehusfeldt>
Thu 15 Apr 2010 07:22:16 AM UTC, comment #2: 

Hi,

thanks for the quick response.
Do you happen to still have the reference to the original bug report/enhancement request/patch?
This should provide an interesting read.
I'm still pondering the idea of submitting a new proposition (this time including a patch) which would implement option
e) Issue a warning if
- "-r" flag was given on command-line (as opposed to default values read from GREP_OPTIONS or elsewhere)
- no explicit "-" was given on command line
- no file/dir/filesystem-object was given on command-line
- STDIN is a tty

If it isn't accepted I can still use it locally ;)
My first problem is that I cannot find the source package in my ubuntu9.10 apt-cache, though :(

Regards,
t[~]

Torge Husfeldt <torgehusfeldt>
Wed 14 Apr 2010 01:52:42 PM UTC, comment #1: 

Yes, this came up other times, and there's even a patch from Apple to do that.  I don't know if the patch supports giving no warning for "-".  My main problem is what happens if someone has GREP_OPTIONS=-r; there were reports of having GREP_OPTIONS=-E which is much more insane, so I wouldn't be surprised to see that in the wild.

An option d) is issue a warning if the input is a tty.  I don't recall if that's what Apple's patch implements, I don't think so but it would be my preferred choice.

Closing as duplicate, but anyway thanks for the ideas!

Paolo Bonzini <bonzini>
Wed 14 Apr 2010 11:24:43 AM UTC, original submission:  

Observations:
1. People tend to be sloppy
2. There is no way to "recursively" read from STDIN -- at least that i know of
3. grep will try to read from STDIN forever if -r (--recursive) and no file/directory is supplied
4. People accidentally calling grep with this combination of parameters will often expect a considerable delay before seeing the first result and thus are even more frustrated when finally realizing that grep wasn't working at all, but waitin

Proposal:
a. immediately issue a warning/error message if this combination occurs
or:
b. issue a warning/error message if this combination occurs and no input is read for some time (~10 seconds?)

In both cases the new behavior can be avoided by providing explicit "-" as filename -- if this seems useful

c. (least preferred, but maybe closest to what the user expects -- who knows?!) if the combination occurs assume "." as starting point

Thanks for considering.
 -- maybe I'm especially dumb, but I've been bitten by this time and again and always very painfully

Torge Husfeldt <torgehusfeldt>

 

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

    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
    2010-04-14 bonzini StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code