GNU bug report logs -
#17763
grep --exclude does not match files as documented in man page
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
It seems file globbing as done by 'grep --exclude' is broken when wildcards are used.
$ echo foo >bar
$ grep --exclude='.*' . ./bar
$ grep --exclude='.*' . bar
foo
Expected behavior: grep -exclude should not exclude bar, whether it is prefixed by ./ or not. According to the man page:
" --exclude=GLOB
Skip files whose *base name* matches GLOB (using wildcard matching). [...]"
This behavior seems to only occur with whenever a directory component of the file path matches the GLOB, e.g.:
$ grep --exclude '.*' . ../bar
$ grep --exclude '.*' . .../bar
$ grep --exclude '.*' . .TEST/bar
$ grep --exclude '.*' . hugues/.TEST/bar
The bug triggers with other globs, unless there is no wildcard:
$ grep --exclude 'w*' . work/bar
$ grep --exclude 'work' . work/bar
foo
Regards,
Hugues Andreux
*************************************************************************
This message and any attachments (the "message") are confidential, intended solely for the addressee(s), and may contain legally privileged information.
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or
falsified.
Please visit http://swapdisclosure.sgcib.com for important information with respect to derivative products.
************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et susceptibles de contenir des informations couvertes
par le secret professionnel.
Ce message est etabli a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration.
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.
Veuillez consulter le site http://swapdisclosure.sgcib.com afin de recueillir d'importantes informations sur les produits derives.
*************************************************************************
[Message part 2 (text/html, inline)]
This bug report was last modified 10 years and 318 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.