Subject: Re: bug#21027: --exclude-dir matches search dir

From: Jim Meyering <[email-masked]>
Date: Fri, 17 Jul 2015 14:31:27 -0700

On Mon, Jul 13, 2015 at 4:35 PM, Paul Eggert <[email-masked]> wrote:
> Aron Griffis wrote:
>>
>> This generates output:
>>
>> $ grep -rl --exclude-dir=usr LINUX /usr/include
>>
>> and this doesn't:
>>
>> $ grep -rl --exclude-dir='usr*' LINUX /usr/include
>>
>> This feels like a bug.
>
> Thanks for reporting that.  I installed the attached patch.

I've pushed this small follow-up patch to fix a false-positive test failure:
From e9a4b74da553c56ccb2e281caec36a316ab2ddc1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Fri, 17 Jul 2015 14:02:35 -0700
Subject: [PATCH] tests: avoid FS-dependent false-positive failure

* tests/include-exclude: Sort file name list, so that this test
is not sensitive to the order in which those names are returned
via readdir. I noticed the failure on a Fedora 21 system using ext4.
Also fix a typo: s/framework_failure+/framework_failure_/
---
 tests/include-exclude | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/include-exclude b/tests/include-exclude
index 8b2f5aa..cdbb9d6 100755
--- a/tests/include-exclude
+++ b/tests/include-exclude
@@ -14,7 +14,7 @@ printf '%s\n' x/a:aaa x/b:bbb     > exp-not-dir || framework_failure_
 printf '%s\n' x/a:aaa             > exp-a       || framework_failure_
 printf '%s\n' a:aaa               > exp-aa      || framework_failure_
 printf '%s\n' aaa                 > exp-aaa     || framework_failure_
-printf '%s\n' ./x/a ./x/b ./x/dir/d > exp-dotnames || framework_failure+
+printf '%s\n' ./x/a ./x/b ./x/dir/d | sort > exp-dotnames || framework_failure_

 grep -r --exclude='a*'    . x > out || fail=1
 sort out > k && mv k out
@@ -59,7 +59,7 @@ compare exp-a out || fail=1
 (cd x && grep -r --exclude-dir=. '^aaa$') > out || fail=1
 compare exp-aa out || fail=1

-grep --exclude=- '^aaa$' - < x/a > out || fail=1
+grep --exclude=- '^aaa$' - < x/a | sort > out || fail=1
 compare exp-aaa out || fail=1

 for exclude in 'x' 'x*'; do
-- 
2.3.7