Re: "grep -rI ... /" vs. processing of /dev/ : should "--exclude-dir /dev" be required in order to avoid /dev/?

From: Kyle Evans <kevans_at_freebsd.org>
Date: Tue, 16 Feb 2021 19:29:45 -0600
On Tue, Feb 16, 2021 at 7:23 PM Mark Millard via freebsd-current
<freebsd-current_at_freebsd.org> wrote:
>
> I historically on occasion have done something like:
>
> # grep -rI ... /
>
> in order to find all instances of a text, including
> in build trees and such. I now find that I need to
> do something more like (using a more specific
> example):
>
> # grep -rI --exclude-dir /dev '#define.*__FreeBSD_version'
>
> otherwise the grep ends up reading from the tty and waits
> for it. Top shows, for example,
>
> 13470 root         22    0  12848Ki    2692Ki ttyin   11   0:00   0.00% grep -rI #define.*__FreeBSD_version /
>
> Is this expected? Should I have always been using
> "--exclude-dir /dev"? What lead to the behavior
> change?
>

I can't seem to find any evidence that gnugrep in base handled this
any differently. Experimentation seems to reveal that modern gnugrep
will skip devices unless they're explicitly named for searching
(unless supplied a different --devices option), which does feel like a
good idea.
Received on Wed Feb 17 2021 - 00:29:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:27 UTC