This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
bug: posix/fnmatch_loop.c ?
- To: libc-alpha at sources dot redhat dot com
- Subject: bug: posix/fnmatch_loop.c ?
- From: Isamu Hasegawa <isamu at yamato dot ibm dot com>
- Date: Thu, 01 Feb 2001 10:24:58 +0900 (JST)
- Cc: shoji at jp dot ibm dot com
Dear glibc developers,
I wonder posix/fnmatch_loop.c has a bug.
Following program said [[.a.]] didn't match with 'a' in en_US.UTF-8.
I think attached patch can fix it.
#include <locale.h>
#include <fnmatch.h>
int main()
{
char *pat = "[[.a.]]";
char *stra = "a";
int flag = 0;
char* cloc;
cloc = setlocale(LC_ALL, "C");
printf("current locale: %s\n", cloc);
printf("pat: %s, str: %s ->", pat, stra);
printf("%s\n", fnmatch(pat, stra, flag)? "not match": "match");
cloc = setlocale(LC_ALL, "en_US.UTF-8");
printf("current locale: %s\n", cloc);
printf("pat: %s, str: %s ->", pat, stra);
printf("%s\n", fnmatch(pat, stra, flag)? "not match": "match");
}
Thanks,
--
Isamu Hasegawa
IBM Japan, Ltd.
--- posix/fnmatch_loop.c.orig Thu Feb 1 10:07:14 2001
+++ posix/fnmatch_loop.c Thu Feb 1 10:08:42 2001
@@ -531,7 +531,7 @@
c = *p++;
}
- else if (symb_table[2 * elem] != 0 && c1 == 1)
+ else if (symb_table[2 * elem] == 0 && c1 == 1)
{
/* No valid character. Match it as a
single byte. */