[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22144: --exclude no longer works against arguments with a directory
From: |
Vincent Lefevre |
Subject: |
bug#22144: --exclude no longer works against arguments with a directory name |
Date: |
Sat, 12 Dec 2015 02:56:34 +0100 |
User-agent: |
Mutt/1.5.24-6539-vl-r83103 (2015-12-08) |
On 2015-12-11 13:37:46 -0800, Paul Eggert wrote:
> The change in grep 2.22 is due to an earlier bug report:
>
> http://bugs.gnu.org/21027
This one was about --exclude-dir, whose description in grep 2.21 is
very unclear and it was already broken anyway:
zira:~> grep -rl e --exclude-dir='usr*' /usr/include
zira:~> grep -rl e --exclude-dir='usr*' /usr/include/stdio.h
/usr/include/stdio.h
But for --exclude, the description is clear:
--exclude=GLOB
Skip files whose base name matches GLOB (using wildcard
^^^^^^^^^
matching). A file-name glob can use *, ?, and [...]
as wildcards, and \ to quote a wildcard or backslash
character literally.
"base name" means base name, not the full path!
I suggest that you revert the behavior for --exclude so that existing
scripts are not broken, and possibly add --exclude-path to match the
full path.
Now, --exclude was already broken:
$ grep -l . /usr/share/doc/grep/*
/usr/share/doc/grep/AUTHORS
/usr/share/doc/grep/NEWS.gz
/usr/share/doc/grep/README
/usr/share/doc/grep/THANKS.gz
/usr/share/doc/grep/TODO.gz
/usr/share/doc/grep/changelog.Debian.gz
/usr/share/doc/grep/changelog.gz
/usr/share/doc/grep/copyright
$ grep -l --exclude='*e*' . /usr/share/doc/grep/*
outputs nothing, while one should get:
/usr/share/doc/grep/AUTHORS
/usr/share/doc/grep/NEWS.gz
/usr/share/doc/grep/README
/usr/share/doc/grep/THANKS.gz
/usr/share/doc/grep/TODO.gz
/usr/share/doc/grep/copyright
excluding files whose base name contains a letter "e".
And with grep 2.22, this is still inconsistent:
ypig:~> grep -l --exclude=AUTHORS . /usr/share/doc/grep/*
/usr/share/doc/grep/AUTHORS
/usr/share/doc/grep/NEWS.gz
/usr/share/doc/grep/README
/usr/share/doc/grep/THANKS.gz
/usr/share/doc/grep/TODO.gz
/usr/share/doc/grep/changelog.Debian.gz
/usr/share/doc/grep/changelog.gz
/usr/share/doc/grep/copyright
ypig:~> grep -rl --exclude=AUTHORS . /usr/share/doc/grep
/usr/share/doc/grep/TODO.gz
/usr/share/doc/grep/changelog.gz
/usr/share/doc/grep/changelog.Debian.gz
/usr/share/doc/grep/THANKS.gz
/usr/share/doc/grep/NEWS.gz
/usr/share/doc/grep/copyright
/usr/share/doc/grep/README
--
Vincent Lefèvre <address@hidden> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
- bug#22144: --exclude no longer works against arguments with a directory name, Vincent Lefevre, 2015/12/11
- bug#22144: --exclude no longer works against arguments with a directory name, Paul Eggert, 2015/12/11
- bug#22144: --exclude no longer works against arguments with a directory name,
Vincent Lefevre <=
- bug#22144: --exclude no longer works against arguments with a directory name, Paul Eggert, 2015/12/11
- bug#22144: --exclude no longer works against arguments with a directory name, Vincent Lefevre, 2015/12/15
- bug#22144: --exclude no longer works against arguments with a directory name, Paul Eggert, 2015/12/15
- bug#22144: --exclude no longer works against arguments with a directory name, Vincent Lefevre, 2015/12/15
- bug#22144: --exclude no longer works against arguments with a directory name, Paul Eggert, 2015/12/16
- bug#22144: --exclude no longer works against arguments with a directory name, Vincent Lefevre, 2015/12/16
- bug#22144: --exclude no longer works against arguments with a directory name, Paul Eggert, 2015/12/16
- bug#22144: --exclude no longer works against arguments with a directory name, Paul Eggert, 2015/12/28
- bug#22144: --exclude no longer works against arguments with a directory name, Vincent Lefevre, 2015/12/30
- bug#22144: --exclude no longer works against arguments with a directory name, Paul Eggert, 2015/12/31