GNU bug report logs - #33699
Multi-component paths ignored by --{exclude,include}-dir ?

Previous Next

Package: grep;

Reported by: Lyude Paul <lyude <at> redhat.com>

Date: Tue, 11 Dec 2018 00:19:02 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33699 in the body.
You can then email your comments to 33699 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#33699; Package grep. (Tue, 11 Dec 2018 00:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lyude Paul <lyude <at> redhat.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Tue, 11 Dec 2018 00:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lyude Paul <lyude <at> redhat.com>
To: bug-grep <at> gnu.org
Subject: Multi-component paths ignored by --{exclude,include}-dir ?
Date: Mon, 10 Dec 2018 18:48:22 -0500
Hi! Sorry for bugging you, but I noticed something a little peculiar about
grep that I wasn't expecting, and I'm not sure if this is a bug or not.
I've been trying to use grep in one of my scripts to exclude files from
any directories starting with Documentation/output using --exclude-dir.
Example:

grep vcpi_ . -rl --exclude-dir Documentation/output

However, this doesn't seem to work at all as it returns:

./Module.symvers
./drivers/gpu/drm/radeon/radeon_dp_mst.c
./drivers/gpu/drm/drm_dp_mst_topology.c
./drivers/gpu/drm/nouveau/dispnv50/disp.c
./drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
./drivers/gpu/drm/nouveau/include/nvif/cl5070.h
./drivers/gpu/drm/Module.symvers
./drivers/gpu/drm/i915/intel_dp_mst.c
./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
./include/drm/drm_dp_mst_helper.h
./Documentation/output/gpu/drm-kms-helpers.html
./Documentation/output/gpu/drm-dp-mst-helpers.html
./Documentation/output/gpu/dp-mst.html
./Documentation/output/genindex.html
./Documentation/output/latex/gpu.aux
./Documentation/output/latex/gpu.tex
./Documentation/output/searchindex.js

I would have thought maybe this could be worked around by using
--exclude instead:

grep vcpi_ . -rl --exclude '.*Documentation/output.*'

But the result is the same. Is this intentional, or an actual bug?
Either way, at the very least it seems like something that should be
clarified in the man page.
-- 
Cheers,
	Lyude Paul





Information forwarded to bug-grep <at> gnu.org:
bug#33699; Package grep. (Tue, 11 Dec 2018 01:15:13 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lyude Paul <lyude <at> redhat.com>
To: bug-grep <at> gnu.org
Subject: Re: Multi-component paths ignored by --{exclude,include}-dir ?
Date: Mon, 10 Dec 2018 18:51:06 -0500
Oh whoops, almost forgot to mention the version of grep I'm using:

grep-3.1-8.fc29 on Fedora 29

I've also checked through the source files for Fedora's grep package, and
confirmed there's no patches getting applied that would modify the behavior of
--exclude and friends.

On Mon, 2018-12-10 at 18:48 -0500, Lyude Paul wrote:
> Hi! Sorry for bugging you, but I noticed something a little peculiar about
> grep that I wasn't expecting, and I'm not sure if this is a bug or not.
> I've been trying to use grep in one of my scripts to exclude files from
> any directories starting with Documentation/output using --exclude-dir.
> Example:
> 
> grep vcpi_ . -rl --exclude-dir Documentation/output
> 
> However, this doesn't seem to work at all as it returns:
> 
> ./Module.symvers
> ./drivers/gpu/drm/radeon/radeon_dp_mst.c
> ./drivers/gpu/drm/drm_dp_mst_topology.c
> ./drivers/gpu/drm/nouveau/dispnv50/disp.c
> ./drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
> ./drivers/gpu/drm/nouveau/include/nvif/cl5070.h
> ./drivers/gpu/drm/Module.symvers
> ./drivers/gpu/drm/i915/intel_dp_mst.c
> ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> ./include/drm/drm_dp_mst_helper.h
> ./Documentation/output/gpu/drm-kms-helpers.html
> ./Documentation/output/gpu/drm-dp-mst-helpers.html
> ./Documentation/output/gpu/dp-mst.html
> ./Documentation/output/genindex.html
> ./Documentation/output/latex/gpu.aux
> ./Documentation/output/latex/gpu.tex
> ./Documentation/output/searchindex.js
> 
> I would have thought maybe this could be worked around by using
> --exclude instead:
> 
> grep vcpi_ . -rl --exclude '.*Documentation/output.*'
> 
> But the result is the same. Is this intentional, or an actual bug?
> Either way, at the very least it seems like something that should be
> clarified in the man page.
-- 
Cheers,
	Lyude Paul





Information forwarded to bug-grep <at> gnu.org:
bug#33699; Package grep. (Tue, 11 Dec 2018 01:15:13 GMT) Full text and rfc822 format available.

Message #11 received at 33699 <at> debbugs.gnu.org (full text, mbox):

From: Lyude Paul <lyude <at> redhat.com>
To: 33699 <at> debbugs.gnu.org
Subject: More info
Date: Mon, 10 Dec 2018 19:26:06 -0500
Just sending this here again, since I realized that my original response to my
own message that was sent to bug-grep <at> gnu.org probably did not get carried
over into the bug tracker (if it did, apologies for the extra noise):

> Oh whoops, almost forgot to mention the version of grep I'm using:
> 
> grep-3.1-8.fc29 on Fedora 29
> 
> I've also checked through the source files for Fedora's grep package, and
> confirmed there's no patches getting applied that would modify the behavior
> of
> --exclude and friends.

-- 
Cheers,
	Lyude Paul





Information forwarded to bug-grep <at> gnu.org:
bug#33699; Package grep. (Sat, 15 Dec 2018 19:14:01 GMT) Full text and rfc822 format available.

Message #14 received at 33699 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: lyude <at> redhat.com
Cc: 33699 <at> debbugs.gnu.org
Subject: Re: bug#33699: Multi-component paths ignored by --{exclude,
 include}-dir ?
Date: Sat, 15 Dec 2018 11:12:48 -0800
tags 33699 notabug
close 33699
stop

On Mon, Dec 10, 2018 at 5:29 PM Lyude Paul <lyude <at> redhat.com> wrote:
> Oh whoops, almost forgot to mention the version of grep I'm using:
> grep-3.1-8.fc29 on Fedora 29
>
> I've also checked through the source files for Fedora's grep package, and
> confirmed there's no patches getting applied that would modify the behavior of
> --exclude and friends.
>
> On Mon, 2018-12-10 at 18:48 -0500, Lyude Paul wrote:
> > Hi! Sorry for bugging you, but I noticed something a little peculiar about
> > grep that I wasn't expecting, and I'm not sure if this is a bug or not.
> > I've been trying to use grep in one of my scripts to exclude files from
> > any directories starting with Documentation/output using --exclude-dir.
> > Example:
> >
> > grep vcpi_ . -rl --exclude-dir Documentation/output
> >
> > However, this doesn't seem to work at all as it returns:
> >
> > ./Module.symvers
> > ./drivers/gpu/drm/radeon/radeon_dp_mst.c
> > ./drivers/gpu/drm/drm_dp_mst_topology.c
> > ./drivers/gpu/drm/nouveau/dispnv50/disp.c
> > ./drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
> > ./drivers/gpu/drm/nouveau/include/nvif/cl5070.h
> > ./drivers/gpu/drm/Module.symvers
> > ./drivers/gpu/drm/i915/intel_dp_mst.c
> > ./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> > ./include/drm/drm_dp_mst_helper.h
> > ./Documentation/output/gpu/drm-kms-helpers.html
> > ./Documentation/output/gpu/drm-dp-mst-helpers.html
> > ./Documentation/output/gpu/dp-mst.html
> > ./Documentation/output/genindex.html
> > ./Documentation/output/latex/gpu.aux
> > ./Documentation/output/latex/gpu.tex
> > ./Documentation/output/searchindex.js

Thanks for the report. However you are searching recursively, so when
the manual says this:

       --exclude-dir=GLOB
              ... When searching  recursively, skip any subdirectory
whose base name matches GLOB.  Ignore any redundant trailing slashes
in GLOB.

it means that a nontrivial GLOB containing a slash will never match,
since the only base name that can contain a slash is the degenerate
one: "/".

> > I would have thought maybe this could be worked around by using
> > --exclude instead:
> >
> > grep vcpi_ . -rl --exclude '.*Documentation/output.*'

You've specified what looks like regular expression, with ".*" at
front and back. this option takes a GLOB, not a regular expression.
And as above, when recursive, the GLOB cannot usefully contain a
slash.

As such, I'm closing this as not-a-bug.




Added tag(s) notabug. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Thu, 02 Jan 2020 08:58:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 33699 <at> debbugs.gnu.org and Lyude Paul <lyude <at> redhat.com> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Thu, 02 Jan 2020 08:58:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 Jan 2020 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 85 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.