Bug 192579

Summary: named pipe vs "grep -sr"
Product: [Fedora] Fedora Reporter: John Reiser <jreiser>
Component: grepAssignee: Tim Waugh <twaugh>
Status: CLOSED DUPLICATE QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-21 09:44:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Reiser 2006-05-20 22:31:46 UTC
Description of problem:
A named pipe interferes with the use of "grep -sr <term> <directory>" to search
an entire directory tree in a reliable way.

Version-Release number of selected component (if applicable):
grep-2.5.1-52.2

How reproducible:
Always

Steps to Reproduce:
1. mkdir dir1
2. cd dir1; mkfifo fifo
3. cd ..; grep -sr foo . &
4. strace -p <pid-of-grep-above>
  
Actual results:
$ strace -p 3044
Process 3044 attached - interrupt to quit
open("dir1/fifo", O_RDONLY|O_LARGEFILE
## This shows that grep is blocked waiting for the fifo.

Expected results:
Under flags "-sr", grep should not wait for fifos.  Grep should ignore an empty
fifo entirely; and read a non-empty fifo with non-blocking I/O, and assume
End-of-File as soon as the read() returns 0 or -1.  Or, there should be another
command-line flag to specify the behavior "don't wait for fifos", so that there
is some reliable way to search a directory tree for strings.

Additional info:

Comment 1 Tim Waugh 2006-05-21 09:44:37 UTC
In theory, '-D skip' is the option you want.  In practice, it's broken. :-/

*** This bug has been marked as a duplicate of 189580 ***