bug#61128: [PATCH] Use complementation correctly in shell globs

Håkon Løvdal <[email protected]> Sun, 29 Jan 2023 11:24:53 +0100
Newsgroups gmane.comp.gnu.parted.bugs
Message-ID <CAACXqO9At=ML8Avj_W0yehs2sqEpuo6ynR5rFXb=mJFmmuVBxg@mail.gmail.com>
This looks good to me. While shells often accept both ! and ^
(https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Pattern-Matching:
"3.5.8.1 Pattern Matching ... "[…]" Matches any one of the enclosed
characters. ...
If the first character following the ‘[’ is a ‘!’ or a ‘^’ then any
character not enclosed is matched.")
it is not portable.

https://www.linux.com/news/patterns-and-string-processing-shell-scripts/:
"Many users have the habit of using a caret (^) instead of ! in shell
character classes.
This is not portable, but it is a common extension some shells offer
because habitual
users of regular expressions may be more used to it. This can create
an occasional
surprise if you have never seen it used, and want to match a caret in a class."

On Sun, 29 Jan 2023 at 00:43, Kerin Millar <[email protected]> wrote:
>
> Hello,
>
> The attached patch rectifies a spurious test failure reported at https://bugs.gentoo.org/890869. As explained by the commit message, the exclamation mark character should be used to perform negations within bracket expressions, not the circumflex character.
>
> --
> Kerin Millar