2022-02-21 17:06:13 +0000, Harald van Dijk: [...] > > If you want to escape ^ to always be treated as a literal when calling > > fnmatch(), you have to spell it something like [[=^=]...], not [\^...] > > (that is, since \^ inside [] does NOT treat the \ as an escape > > character, but as yet another literal character as part of the brakcet > > group, you instead have to resort to calling out the literal character > > ^ via alternative spellings such as by a collation equivalent). > > This is correct for regular expressions, unspecified for shell patterns in > general after bug 1234 was resolved, and always incorrect for fnmatch() > after bug 1190 was resolved. In fnmatch(), backslash has to work even inside > bracket expressions. Whether it had to may not previously have been clear in > the standard, but it has been made clear now and that is also how it works > in glibc. That part of the patch is not a problem. [...] Thanks, and sorry about that. I was actually the one raising bug 1234 and misremembered the outcome. case $var in ([\!x]) is specified, but: pattern='[\!x]' case $var in ($pattern) is not indeed, so, the behaviour of: sh -c 'case "\\" in ($1) echo match; esac' sh '[\^x]' is unspecified, so even though that patch changes the behaviour in this instance, it's still not a conformance bug. -- Stephane