Subject: bug#33699: Multi-component paths ignored by --{exclude,include}-dir ?

From: Lyude Paul <[email-masked]>
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