Date: Wed, 17 Feb 2021 13:44:45 -0600 From: Kyle Evans <kevans@freebsd.org> To: Mark Millard <marklmi@yahoo.com> Cc: freebsd-current <freebsd-current@freebsd.org> Subject: Re: "grep -rI ... /" vs. processing of /dev/ : should "--exclude-dir /dev" be required in order to avoid /dev/? Message-ID: <CACNAnaE1g1vAeq1yw5_KjfQ%2BjgCFCgTXOGBh-K4ggKSra-cctw@mail.gmail.com> In-Reply-To: <CACNAnaES4r3bMjhzTz_qMh5SGVypFuF%2BrSkDHc00xczFjK73vg@mail.gmail.com> References: <B822DED7-0607-47F3-8C1F-4C814D2A9EF5.ref@yahoo.com> <B822DED7-0607-47F3-8C1F-4C814D2A9EF5@yahoo.com> <CACNAnaES4r3bMjhzTz_qMh5SGVypFuF%2BrSkDHc00xczFjK73vg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 16, 2021 at 7:29 PM Kyle Evans <kevans@freebsd.org> wrote: > > On Tue, Feb 16, 2021 at 7:23 PM Mark Millard via freebsd-current > <freebsd-current@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. Here's my proposal: https://people.freebsd.org/~kevans/grep-rdev.diff
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaE1g1vAeq1yw5_KjfQ%2BjgCFCgTXOGBh-K4ggKSra-cctw>