On 2021-Feb-17, at 11:44, Kyle Evans <kevans at freebsd.org> wrote: > On Tue, Feb 16, 2021 at 7:29 PM Kyle Evans <kevans at freebsd.org> wrote: >> >> 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. > > Here's my proposal: https://people.freebsd.org/~kevans/grep-rdev.diff wget, git apply, buildworld, installworld, and some quick testing: Seems to work as described in the updated man page and avoids my needing "--exclude-dir /dev" (or other alternatives) by default with the -r . I did try some explicit /dev and /dev/tty and /dev/random use, and some "no -r" variations of the -r testing. While it was just quick testing, I did not notice anything odd happening. I did do one -r for / that I let run to completion. FYI: this is based on main 3acea07c1873 as a context. In more detail: # ~/fbsd-based-on-what-freebsd-main.sh merge-base: 3acea07c1873b1e4042f4a4fa8668745ee59f15b merge-base: CommitDate: 2021-02-08 19:15:21 +0000 c1845d00f818 (HEAD -> mm-src) mm-src snapshot for mm's patched build in git context. 3acea07c1873 (pure-src) Restore the augmented strlen commentary FreeBSD FBSDFHUGE 14.0-CURRENT FreeBSD 14.0-CURRENT mm-src-n244686-c1845d00f818 GENERIC-NODBG amd64 amd64 1400004 1400004 === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)Received on Wed Feb 17 2021 - 21:26:43 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:27 UTC