|
|
Message-ID: <20261006180243.GA16915@brightrain.aerifal.cx> Date: Tue, 6 Oct 2026 14:02:44 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: [PATCH] fnmatch conformance fixes and collation element/class support I intend to hold off on this series until after release, as the things it fixes are less a matter of outright bugs than interpretations of the spec and addition of new features. But here it is now for review/testing if anyone likes. The major change in interpretation is that the escape character \ is now supported inside bracket expressions. Not doing that before was based on my misreading of the spec and is not supported in the text. Some aspecs of escaping/quoting are underspecified, like whether parts of the name of a character class can be escaped, but I opted to support that in the absence of any reason not to, since shells using fnmatch need to be able to convert shell quoting to escapes and not have things break. For consistency, since we stop parsing on an early match, invalid bytes in bracket expressions are now ignored (they contribute nothing to the matching set). Before, [a\200b] would match "a" but not "b" because the bracket became unmatchable upon hitting the invalid byte. Collation symbols and equivalence classes were previously treated as non-matching. Prior to the last patch in this series, they are parsed and treated the same as the unadorned character. With the last patch applied, they honor the active collation ordering; together with the locale overhaul series and a locale with nontrivial collation rules, this yields significant new behavior. For example [[.a.]-[.z.]] and [[=a=]] may both match "A" and "á". Ranges expressed without collation symbol notation, e.g. [a-z], are still pure codepoint order. And ranges expressed half-and-half match each end according to the form used; for example [a-[.z.]] will match "á" because L'á' >= L'a' but will not match "A" because L'A' < L'a'. I'm not sure if this last propery is useful but it was the most consistent. View attachment "0001-fnmatch-restructure-match_bracket-range-handling.patch" of type "text/plain" (1753 bytes) View attachment "0002-fnmatch-don-t-call-wctype-twice-per-character-class.patch" of type "text/plain" (905 bytes) View attachment "0003-fnmatch-accept-collation-symbols-and-equivalence-cla.patch" of type "text/plain" (1141 bytes) View attachment "0004-fnmatch-ignore-invalid-encodings-in-bracket.patch" of type "text/plain" (802 bytes) View attachment "0005-fnmatch-honor-escaping-in-bracket-expressions.patch" of type "text/plain" (4421 bytes) View attachment "0006-fnmatch-do-collation-comparisons-for-equivalence-cla.patch" of type "text/plain" (2774 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.