bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MirBSD mbtowc bug? failure on test-wcrtomb


From: Bruno Haible
Subject: Re: MirBSD mbtowc bug? failure on test-wcrtomb
Date: Fri, 22 Oct 2010 02:21:06 +0200
User-agent: KMail/1.9.9

Eric Blake wrote:
> LC_ALL=ja_JP gltests/test-wcrtomb 3
> ../../gltests/test-wcrtomb.c:43: assertion failed
> Abort trap (core dumped)
> 
> (gdb) bt
> #0  0x0297e103 in kill () from /usr/lib/libc.so.41.8
> #1  0x029ba59c in abort () from /usr/lib/libc.so.41.8
> #2  0x1c0008bc in check_character (s=0xcfbf8489 
> "\306\374\313\334\270\354>", n=2)
>      at ../../gltests/test-wcrtomb.c:43
> #3  0x1c000d0c in main (argc=2, argv=0xcfbf84f8)
>      at ../../gltests/test-wcrtomb.c:136
> 
> $ locale -a
> C
> en_US.OPTU-8
> en_US.UTF-8
> POSIX
> 
> oddly enough, that doesn't include ja_JP; maybe the configure test that 
> learned whether ja_JP exists is broken?

Yes, it's indicating that test whether the ja_JP locale is supported is
incomplete. Can you run this program, please, and report the output?

============================== foo.c ===============================
#include <locale.h>
#include <time.h>
#include <langinfo.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <locale.h>
struct tm t;
char buf[16];

int main ()
{
  int ret;
  char *loc;
  const char *p;

  loc = setlocale (LC_ALL, "ja_JP");
  if (loc != NULL)
    fprintf (stderr, "setlocale succeeded -> %s\n", loc);

  {
    const char *cs = nl_langinfo (CODESET);
    if (cs != NULL)
      fprintf (stderr, "nl_langinfo (CODESET) = |%s|\n", cs);
  }

  fprintf (stderr, "MB_CUR_MAX = %d\n", (int) MB_CUR_MAX);

  t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
  ret = strftime (buf, sizeof (buf), "%B", &t);
  fprintf (stderr, "strftime -> %d\n", ret);
  if (ret >= 2)
    {
      for (p = buf; *p != '\0'; p++)
        fprintf (stderr, " %02X", (unsigned char) *p);
      fprintf (stderr, "\n");
    }

  {
    wchar_t wc = (wchar_t) 0xBADFACE;
    ret = mbtowc (&wc, "\306\374\313\334\270\354>", 2);
    fprintf (stderr, "mbtowc -> %d %04X\n", ret, wc);
  }

  return 0;
}
=========================================================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]