From dd10dfda5834b0e67ebab0425d0a48fbfc939d7f Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 9 Aug 2021 14:41:48 +0100 Subject: win32: fix fnmatch(3) handling of xdigit The glob pattern '[[:xdigit::]]*' didn't return the matches expected. It turns out the implementation (from glibc) fails to detect 'xdigit' as a valid character class. Changing the definition of CHAR_CLASS_MAX_LENGTH to 7 fixes the problem. This was never an issue in glibc because it uses a different definition. More modern versions of fnmatch(3) in glibc and gnulib also make CHAR_CLASS_MAX_LENGTH long enough. The code for fnmatch(3) was taken from glibc at commit 7814856974388a856a575fa45f88d502c8a1ab29. This was the last version before the code was rearraged to better support multibyte characters. --- win32/fnmatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/fnmatch.c b/win32/fnmatch.c index 5d2ea685d..0e76a7ba1 100644 --- a/win32/fnmatch.c +++ b/win32/fnmatch.c @@ -108,7 +108,7 @@ int index_in_strings(const char *strings, const char *key) FAST_FUNC; # define IS_CHAR_CLASS(string) wctype (string) # endif # else -# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ +# define CHAR_CLASS_MAX_LENGTH 7 /* Namely, `xdigit'. */ # define IS_CHAR_CLASS(string) \ (STREQ (string, "alpha") || STREQ (string, "upper") \ -- cgit v1.2.3-55-g6feb