public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "stephane+sourceware at chazelas dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug glob/31075] fnmatch("??") matches on 2-byte single characters (as well as 2 any-length characters)
Date: Sat, 18 Nov 2023 11:53:33 +0000	[thread overview]
Message-ID: <bug-31075-131-SOTdExuJSi@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31075-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31075

--- Comment #1 from Stephane Chazelas <stephane+sourceware at chazelas dot org> ---
(In reply to Stephane Chazelas from comment #0)
> Regression introduced in 2.34 by commit
> a79328c745219dcb395070cdcd3be065a8347f24  reproduced on Ubuntu 22.04, Debian
> sid libc6:amd64 2.37-12, and current git HEAD
> (dae3cf4134d476a4b4ef86fd7012231d6436c15e) built on that sid system.
> 
> find . -name '??'
[...]

To clarify, "find" is used here to demonstrate the behaviour of the libc's
fnmatch(). Here with GNU find.

$ LD_DEBUG=bindings find é -name '??' |& grep fnmatch
    323895:     binding file /lib/x86_64-linux-gnu/libselinux.so.1 [0] to
/lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `fnmatch' [GLIBC_2.2.5]
    323895:     binding file find [0] to /lib/x86_64-linux-gnu/libc.so.6 [0]:
normal symbol `fnmatch' [GLIBC_2.2.5]

$ ltrace -e 'fnmatch' find é éé $'\U10FFFF\U10FFFF' -name '??'
find->fnmatch("foo", "foo", 0)                                                 
                                      = 0
find->fnmatch("Foo", "foo", 0)                                                 
                                      = 1
find->fnmatch("Foo", "foo", 16)                                                
                                      = 0
find->fnmatch("??", "\303\251", 0)                                             
                                      = 0
é
find->fnmatch("??", "\303\251\303\251", 0)                                     
                                      = 0
éé
find->fnmatch("??", "\364\217\277\277\364\217\277\277", 0)                     
                                      = 0
??
+++ exited (status 0) +++

(here showing ?? matching one 2-byte character, two 2-byte characters and two
4-byte characters).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2023-11-18 11:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 10:03 [Bug glob/31075] New: " stephane+sourceware at chazelas dot org
2023-11-18 11:53 ` stephane+sourceware at chazelas dot org [this message]
2023-11-24 19:56 ` [Bug glob/31075] fnmatch("??") matches on one two byte valid character (as well as two " stephane+sourceware at chazelas dot org

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=bug-31075-131-SOTdExuJSi@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).