Subject: bug#14391: bug in grep -- ignoring GREP_OPTIONS or not acting on it...

From: Linda Walsh <[email-masked]>
Date: Tue, 14 May 2013 10:32:31 -0700

Bob Proulx wrote:
> 
> Basically:
> 
> I think you need --directories=skip in addition to --devices=skip.
> Add -d skip to your option list.
> 
>   grep -D skip -d skip --binary-files=without-match --color=auto foo *
> 
> This is an example of why I think grep should never have added
> directory recursion.  It needs to suck in all of 'find' before it will
> be complete.  And that doesn't make sense because there is already
> find available.
> 
>   find . -type f -exec grep foo {} +
> 
> That isn't precisely the same as the grep case you posted but it is
> usually what people want.  For -D skip it would need to be more like
> this:
> 
>   find . -follow ! -type d -exec grep foo {} +
> 
> If there were often used favorite options then I would turn them into
> either a shell script or a shell function.
----

Very good points -- especially about my broken options (I could swear they worked
in the past)...must have gotten accidently deleted somewhere along in the past.

But .. I also agree with the problems of grep possibly calling find
inefficiently.  I would have thought it smarter to call find as a child, and
read from
it's pipe and call the file-search on large groups at a time.  Otherwise, if grep
waited for all of find to complete, as you are suggesting, might it not run out
of space
to hold the paths of the files it is going to search?