Bug 11626 - Recursive grep hangs when encountering a named pipe
Summary: Recursive grep hangs when encountering a named pipe
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Other
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-21 20:25 UTC by whitedavidp
Modified: 2019-01-21 20:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description whitedavidp 2019-01-21 20:25:00 UTC
I am using BB 1.29.2 on Android and recently encountered a situation when a recursive grep command was hanging. I discovered that in the folder/file tree being recursed there were several files which ls -l shows having a file type of "p", named pipe.

I can understand why this might cause a problem. But it seems that it might be a good idea for grep to check the file type and not even attempt to open/process such files. One would think that this would at least create a file open/read error given that there is the -s option for suppressing output of this nature. But all I get is a hung grep that must be manually killed.

I know how to avoid this using something like this:

     find . -type f -exec grep pattern {}

But this seems far less efficient than having grep the files it intends to try and open.

Thanks very much!