GNU bug report logs - #43782
in egrep (grep 3.0), the order of include & exclude is surprisingly significant

Previous Next

Package: grep;

Reported by: John Ruckstuhl <John.Ruckstuhl <at> intusurg.com>

Date: Sat, 3 Oct 2020 19:03:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: John Ruckstuhl <John.Ruckstuhl <at> intusurg.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: "43782-done <at> debbugs.gnu.org" <43782-done <at> debbugs.gnu.org>
Subject: bug#43782: in egrep (grep 3.0), the order of include & exclude is surprisingly significant
Date: Mon, 5 Oct 2020 15:57:32 +0000
> This
>     $ egrep -r -i -n -l --exclude="*.bak" --include="*.py" "$PAT" "$DIR"
> does not map to this
>     find "$DIR" -type f ! -name "*.bak" -name "*.py" |
>     while read F; do egrep -i -n -l "$PAT" "$F"; done
>
> It maps to this (with INCFIRST representing "-true" or "-false")
>      find "$DIR" -type f \( \
>          \( ! -name "*.bak" ! -name "*.py" \) \( \
>              ! "$INCFIRST" \( -true \) \
>              -o \
>              "$INCFIRST" \( ! -name "*.bak" -name "*.py" \) \
>          \) \
>          -o \
>              \( ! -name "*.bak" -name "*.py" \) \
>      \) |
>     while read F; do egrep -i -n -l "$PAT" "$F"; done
>
> Yikes.
> As it is not yet documented,
> I'll happily venmo you $50 to consider it a bug instead of an undocumented behavior.
> Warm regards, Paul.  :)
> John Ruckstuhl

okay, the above mess simplifies of course to something less yikesy,
    find "$DIR" -type f \( \
        \( ! -name "*.bak" -name "*.py" \) \
        -o ! "$INCFIRST" \( ! -name "*.bak" ! -name "*.py" \) \
    \) |
    while read F; do egrep -i -n -l "$PAT" "$F"; done

but the $50 offer still stands... :)

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

Previous Next


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