Package: grep;
To reply to this bug, email your comments to 68666 AT debbugs.gnu.org.
the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-grep <at> gnu.org:bug#68666; Package grep.
(2024年1月22日 23:49:02 GMT) Full text and rfc822 format available.Karl Berry <karl <at> freefriends.org>:bug-grep <at> gnu.org.
(2024年1月22日 23:49:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Karl Berry <karl <at> freefriends.org> To: bug-grep <at> gnu.org Subject: warning if --exclude-dir arg contains /? Date: 2024年1月22日 16:48:21 -0700
Would it be crazy for grep --exclude-dir=foo/bar to give a warning? Since, as I understand it, any non-trailing / in the arg can never match since the arg is matched against the basename. This came up when I ran grep -r --exclude="t/*.dir", thinking it would exclude all the test output directories. Nope ... --thanks, karl.
bug-grep <at> gnu.org:bug#68666; Package grep.
(2024年1月23日 05:38:01 GMT) Full text and rfc822 format available.Message #8 received at 68666 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Karl Berry <karl <at> freefriends.org>, 68666 <at> debbugs.gnu.org Subject: Re: bug#68666: warning if --exclude-dir arg contains /? Date: 2024年1月22日 21:37:26 -0800
On 2024年01月22日 15:48, Karl Berry wrote: > Would it be crazy for grep --exclude-dir=foo/bar to give a warning? > > Since, as I understand it, any non-trailing / in the arg can never match > since the arg is matched against the basename. That's not quite true, as it can match command-line arguments. For example: $ grep -rl . lib/* | grep '^lib/unictype/\.gitignore$' lib/unictype/.gitignore $ grep --exclude-dir=lib/unictype -rl . lib/* | grep '^lib/unictype/\.gitignore$' $ It should be possible to give useful warnings in some cases, though. It's too bad the rules are so complicated - that's partly my fault, as the various options were added at different times and I didn't think things through as suggestions were made. Probably too late to change the meaning of existing options now, though.
bug-grep <at> gnu.org:bug#68666; Package grep.
(2024年1月23日 22:25:01 GMT) Full text and rfc822 format available.Message #11 received at 68666 <at> debbugs.gnu.org (full text, mbox):
From: Karl Berry <karl <at> freefriends.org> To: eggert <at> cs.ucla.edu Cc: 68666 <at> debbugs.gnu.org Subject: Re: bug#68666: warning if --exclude-dir arg contains /? Date: 2024年1月23日 15:23:50 -0700
That's not quite true, as it can match command-line arguments.
I see. Perhaps the manual could be a little less terse than expecting
readers to understand the difference between "name suffix" and "base
name". Ok, it's clear in retrospect, but ... maybe something like (not
sure I got it correct):
---
Skip any command-line directory with a name suffix (possibly with
several file name components) that matches the pattern @var{glob}.
When searching recursively, skip any subdirectory whose base name
(the last file name component) matches @var{glob}. Ignore any
redundant trailing slashes in @var{glob}.
In other words if @var{glob} contains a @samp{/} (except for the
ignored trailing slashes), the pattern will never match when searching
recursively, but may match against explicit command line arguments.
---
It should be possible to give useful warnings in some cases, though.
If glob contains a / and there are no command line args,
it seems a warning is warranted?
Probably too late to change the meaning of existing options now,
Agreed. --thanks, karl.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.