From owner-freebsd-current@freebsd.org Wed Feb 17 19:44:59 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAA7352EA86 for ; Wed, 17 Feb 2021 19:44:59 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgpG34Rc5z3GNS for ; Wed, 17 Feb 2021 19:44:59 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 875AD2E010 for ; Wed, 17 Feb 2021 19:44:59 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f49.google.com with SMTP id p12so6861532qvv.5 for ; Wed, 17 Feb 2021 11:44:59 -0800 (PST) X-Gm-Message-State: AOAM532LUZNdT3/RJm6rcFXF2svQoL79W4Koh1Q2AY81/p78o265eLTn AKAfUz3RPlJSghBn3NLOZsMAR2z9insxrR4BP3M= X-Google-Smtp-Source: ABdhPJwaPuIBfRBDqJ1hArxwR0T3Ui1jVjM4v8xnwQ8CJBfMsTkthsx9SeDU9mzr5ejPRLAnCP4AroJZG5v/SngNPYc= X-Received: by 2002:a05:6214:bce:: with SMTP id ff14mr589414qvb.26.1613591098966; Wed, 17 Feb 2021 11:44:58 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kyle Evans Date: Wed, 17 Feb 2021 13:44:45 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: "grep -rI ... /" vs. processing of /dev/ : should "--exclude-dir /dev" be required in order to avoid /dev/? To: Mark Millard Cc: freebsd-current Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 19:44:59 -0000 On Tue, Feb 16, 2021 at 7:29 PM Kyle Evans wrote: > > On Tue, Feb 16, 2021 at 7:23 PM Mark Millard via freebsd-current > 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