git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] wildmatch: properly fold case everywhere

From
Duy Nguyen <pclouds@gmail.com>
Date
May 30, 2013, 08:52 UTC
Message-ID
<CACsJy8DpJKPgc2h0yV3ZHOV6mhEGs=j1NZJ2WQBWG7hAk_iuBw@mail.gmail.com>
In-Reply-To
<1369903506-72731-1-git-send-email-n.oxyde@gmail.com>
On Thu, May 30, 2013 at 3:45 PM, Anthony Ramine <n.oxyde@gmail.com> wrote:
Show 14 quoted lines
> Case folding is not done correctly when matching against the [:upper:]
> character class and uppercased character ranges (e.g. A-Z).
> Specifically, an uppercase letter fails to match against any of them
> when case folding is requested because plain characters in the pattern
> and the whole string and preemptively lowercased to handle the base case
> fast.
>
> That optimization is kept and ISLOWER() is used in the [:upper:] case
> when case folding is requested, while matching against a character range
> is retried with toupper() if the character was lowercase, as the bounds
> of the range itself cannot be modified (in a case-insensitive context,
> [A-_] is not equivalent to [a-_]).
>
> Signed-off-by: Anthony Ramine <n.oxyde@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>

If you have time, you may want to send a similar patch to rsync, which contains original wildmatch implementation. It does not look much different from this one, except that (flags & WM_CASEFOLD) is replaced with force_lower_case. Thanks. -- Duy

Previous: Anthony RamineNext: Eric Sunshine
Message 12 of 18 in “wildmatch: properly fold case everywhere”
  1. wildmatch: properly fold case everywhereAnthony Ramine, May 28, 2013
  2. Duy NguyenMay 28, 2013
  3. Anthony RamineMay 28, 2013
  4. wildmatch: properly fold case everywhereAnthony Ramine, May 28, 2013
  5. wildmatch: properly fold case everywhereAnthony Ramine, May 28, 2013
  6. Duy NguyenMay 29, 2013
  7. Anthony RamineMay 29, 2013
  8. Duy NguyenMay 29, 2013
  9. Anthony RamineMay 29, 2013
  10. Duy NguyenMay 30, 2013
  11. wildmatch: properly fold case everywhereAnthony Ramine, May 30, 2013
  12. Duy NguyenMay 30, 2013
  13. Eric SunshineMay 30, 2013
  14. Anthony RamineMay 30, 2013
  15. Eric SunshineMay 30, 2013
  16. wildmatch: properly fold case everywhereAnthony Ramine, May 30, 2013
  17. Junio C HamanoJun 2, 2013
  18. Anthony RamineJun 2, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.