grep does not print warning when recursively grepping stdin

Bug #457277 reported by Dominic Evans
10
This bug affects 2 people
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
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic
SourcePackage: grep
Uname: Linux 2.6.31-14-generic i686

Revision history for this message
Dominic Evans (oldmanuk) wrote :
Revision history for this message
hhaamu (hhaamu) wrote :

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

Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :

Starting from grep 2.11, -r search the currect directory when '.' is not given.

http://git.savannah.gnu.org/cgit/grep.git/tree/NEWS#n162

Is this good enough?

Changed in grep (Ubuntu):
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.