From: Rich Felker <dalias@libc.org>
To: "(GalaxyMaster)" <galaxy@openwall.com.au>
Cc: musl@lists.openwall.com
Subject: Re: [musl] is fnmatch() a bit broken?
Date: Mon, 9 Jan 2023 03:09:20 -0500 [thread overview]
Message-ID: <20230109080920.GC4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <0100018595893ac1-a4a3abcd-d50b-4907-a6bb-6a58d923e6b6-000000@email.amazonses.com>
On Mon, Jan 09, 2023 at 07:57:56AM +0000, (GalaxyMaster) wrote:
> Rich,
>
> On Mon, Jan 09, 2023 at 02:32:13AM -0500, Rich Felker wrote:
> > > galaxy@apollo:~/musl-fnmatch $ ./musl-fnmatch
> > > fnmatch("abc", "abc", 0) = 0 (expected: 0)
> > > fnmatch("[1\]] [1\]]", "1 ]", 0) = 1 (expected: 0)
> >
> > This difference is intentional because glibc's behavior is contrary to
> > the spec.
>
> Thanks for the explanation, today I learnt something :). However, you said:
>
> > A '\' can escape the '[' and make it non-special (not
> > open a bracket) but the '-' inside the bracket is not "special" to
> > begin with -- it's just part of the bracket syntax. Likewise with the
> > closing ']' case.
>
> Which brings a question on the "[1\]] [1\]]" use case not matching "1 ]". If I
> read your response correctly, it is expected to actually match on musl, did I
> get it wrong?
It's been a while since I looked at these, but the key thing is that ]
is not a special character. Only *, ?, and [ are special. ] is just
part of the bracket syntax once the bracket is open, and IIRC \] is
identical to ], closing the bracket. The subsequent ] is then outside
the bracket and matches itself (mismatch here).
Rich
next prev parent reply other threads:[~2023-01-09 8:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-08 13:45 (GalaxyMaster)
2023-01-09 7:32 ` Rich Felker
2023-01-09 7:57 ` (GalaxyMaster)
2023-01-09 8:09 ` Rich Felker [this message]
2023-01-09 8:24 ` (GalaxyMaster)
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 \
--in-reply-to=20230109080920.GC4163@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=galaxy@openwall.com.au \
--cc=musl@lists.openwall.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).