bug: posix/fnmatch_loop.c ?

Isamu Hasegawa isamu@yamato.ibm.com
Wed Jan 31 17:25:00 GMT 2001


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.


More information about the Libc-alpha mailing list