From: Stephane Chazelas <firstname.lastname@example.org> To: Harald van Dijk <email@example.com> Cc: Eric Blake <firstname.lastname@example.org>, Herbert Xu <email@example.com>, firstname.lastname@example.org, email@example.com Subject: Re: [v2 PATCH] expand: Always quote caret when using fnmatch Date: Mon, 21 Feb 2022 19:15:15 +0000 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <email@example.com> 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
next prev parent reply other threads:[~2022-02-21 19:15 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-12 16:25 possible wrong behaviour with patterns using a quoted ^ at the start of a bracket expression Christoph Anton Mitterer 2022-01-12 17:20 ` Harald van Dijk 2022-01-12 17:47 ` Christoph Anton Mitterer 2022-01-12 18:17 ` Harald van Dijk 2022-01-12 18:21 ` Christoph Anton Mitterer 2022-01-18 6:13 ` [PATCH] expand: Always quote caret when using fnmatch Herbert Xu 2022-01-18 8:44 ` Harald van Dijk 2022-01-19 5:37 ` [v2 PATCH] " Herbert Xu 2022-02-20 7:15 ` Stephane Chazelas 2022-02-21 16:39 ` Eric Blake 2022-02-21 17:06 ` Harald van Dijk 2022-02-21 19:15 ` Stephane Chazelas [this message] 2022-01-18 14:29 ` [PATCH] " Christoph Anton Mitterer 2022-01-18 14:54 ` Chet Ramey 2022-01-18 22:33 ` Herbert Xu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [v2 PATCH] expand: Always quote caret when using fnmatch' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).