grep does not print warning when recursively grepping stdin
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grep |
Unknown
|
Unknown
|
|||
grep (Ubuntu) |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: grep
A common user error pattern is to call a recursive grep and miss off the trailing '.' for current directory. This causes grep to wait indefinitely for stdin, but users will presume it is just taking a long time to search and will leave it running
$ grep -r PATTERN
...
...
...<indefinite pause>
This is on Ubuntu karmic running the latest GNU grep 2.5.4
Contrastingly, on a Apple Mac running OS X and grep (GNU grep) 2.5.1 a helpful warning is printed in this case which immediately guides the user to their mistake
$ grep -r PATTERN
grep: warning: recursive search of stdin
I presume this is a custom patch that has been applied to the grep binary that ships with OSX (rather than a warning message that has been purposefully removed), therefore I suggest this warning message is added to the default code base.
ProblemType: Bug
Architecture: i386
Date: Wed Oct 21 15:49:26 2009
DistroRelease: Ubuntu 9.10
Package: grep 2.5.4-4
ProcEnviron:
SHELL=/bin/bash
PATH=(custom, user)
LANG=en_GB.UTF-8
ProcVersionSign
SourcePackage: grep
Uname: Linux 2.6.31-14-generic i686
As someone who has 'grep' aliased to 'grep -r', this behaviour is annoying.
e.g.
$ alias grep='grep --exclude= *.svn-base -Ir'
$ lsof | grep /mnt/
grep: warning: recursive search of stdin