From owner-freebsd-current@freebsd.org Wed Feb 17 01:29:57 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 89A8A52B8E7 for ; Wed, 17 Feb 2021 01:29:57 +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 4DgKyY3QHNz4XNw for ; Wed, 17 Feb 2021 01:29:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 638062549B for ; Wed, 17 Feb 2021 01:29:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f182.google.com with SMTP id w5so3110343qts.12 for ; Tue, 16 Feb 2021 17:29:57 -0800 (PST) X-Gm-Message-State: AOAM5338FtkuGxNYRtLprSzBkyRrcCIoxDH2KtqEKj3Ra/1HNVsldisr yVIWfPCTJzj0lo6Y6xZHHRmy00E2WMUUCHNMbUI= X-Google-Smtp-Source: ABdhPJz1pQH/x4mCOdDAvs6DHdTmxXJ0yw9JIdvh1xqOWoQvCC5xOidgXnL6CWweb/C6QWf2BhadREokNUUtFMca7KA= X-Received: by 2002:ac8:7383:: with SMTP id t3mr20911620qtp.242.1613525396815; Tue, 16 Feb 2021 17:29:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kyle Evans Date: Tue, 16 Feb 2021 19:29: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 01:29:57 -0000 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.