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

[debian-users:06631] Bug#JP/423: mblen() always fails with libc6_2.0.7pre1-4.wcsmbs.2



----Next_Part(Wed_Jun_24_12:56:41_1998_41)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

Package: libc6
Version: 2.0.7pre1-4.wcsmbs.2

libc6_2.0.7pre1-4.wcsmbs.2.deb をインストールすると、mblen()関数が常に-
1を返すようになります。GTK+(libgtk)がmblenを使っているので、GTK+を使っ
たアプリ(GIMPなど)での文字列入力ができなくなります。
libc6_2.0.7pre1-4.wcsmbs.1.deb では問題は発生しません。

添付の lchk.c と Makefile で make lchk_linux_libc6 した後、
lchk_linux_libc6 を実行すると、

===== locale checker ==========
** uname -msrv:
Linux 2.1.105 #9 SMP Wed Jun 17 19:59:46 JST 1998 i686

** locale type:
LIBC_LOCALE

** ls -o /lib/libc.*:
lrwxrwxrwx   1 root           14 Jun 15 14:22 /lib/libc.so.5 -> libc.so.5.4.38
-rwxr-xr-x   1 root       584776 Jun  7 21:09 /lib/libc.so.5.4.38
lrwxrwxrwx   1 root           13 Jun 24 12:44 /lib/libc.so.6 -> libc-2.0.6.so

** setlocale & mblen:
  printf ("[%2d] %s\n", mblen(str, (__ctype_get_mb_cur_max ()) ), str);
  char* locale = setlocale(6 , str);

** TRY [], RETURN [ja_JP.ujis], CURRENT[ja_JP.ujis]
[-1] 漢字
[-1] ABC

** TRY [C], RETURN [C], CURRENT[C]
[-1] 漢字
[-1] ABC

** TRY [ja_JP.ujis], RETURN [ja_JP.ujis], CURRENT[ja_JP.ujis]
[-1] 漢字
[-1] ABC

** TRY [ko_KR.euc], RETURN [(null)], CURRENT[ja_JP.ujis]
[-1] 漢字
[-1] ABC

となります。
libc6_2.0.7pre1-4.wcsmbs.1.deb だと、

===== locale checker ==========
** uname -msrv:
Linux 2.1.105 #9 SMP Wed Jun 17 19:59:46 JST 1998 i686

** locale type:
LIBC_LOCALE

** ls -o /lib/libc.*:
lrwxrwxrwx   1 root           14 Jun 15 14:22 /lib/libc.so.5 -> libc.so.5.4.38
-rwxr-xr-x   1 root       584776 Jun  7 21:09 /lib/libc.so.5.4.38
lrwxrwxrwx   1 root           13 Jun 24 12:50 /lib/libc.so.6 -> libc-2.0.6.so

** setlocale & mblen:
  printf ("[%2d] %s\n", mblen(str, (__ctype_get_mb_cur_max ()) ), str);
  char* locale = setlocale(6 , str);

** TRY [], RETURN [ja_JP.ujis], CURRENT[ja_JP.ujis]
[ 2] 漢字
[-1] ABC

** TRY [C], RETURN [C], CURRENT[C]
[-1] 漢字
[ 1] ABC

** TRY [ja_JP.ujis], RETURN [ja_JP.ujis], CURRENT[ja_JP.ujis]
[-1] 漢字
[ 1] ABC

** TRY [ko_KR.euc], RETURN [(null)], CURRENT[ja_JP.ujis]
[-1] 漢字
[ 1] ABC

となります。

------------------------------------------------------------
田中伸哉(たなか・しんや)
tanaka@xxxxxxxxxxxxxxxxxxxxxxxx



----Next_Part(Wed_Jun_24_12:56:41_1998_41)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

/*
 * locale checker
 */

#ifdef X_LOCALE
#  define ISC
#  define USE_XMBTOWC
#  include <X11/Xlocale.h>
#  include <X11/Xlib.h>
#else
#  include <locale.h>
#endif
#include <stdlib.h>
#include <stdio.h>

#ifndef XINCDIR
#  define XINCDIR ""
#endif

#ifdef X_LOCALE
#  define CCOPT "-DX_LOCALE"
#else
#  define CCOPT ""
#endif

#if   defined FreeBSD
#  define JP_LOCALE "ja_JP.EUC"
#elif defined Solaris
#  define JP_LOCALE "japanese"
#elif defined Linux_libc6
#  define JP_LOCALE "ja_JP.ujis"
#elif defined Linux_libc5
#  define JP_LOCALE "ja_JP.eucJP"
#else
#  define JP_LOCALE "ja_JP.eucJP"
#endif

#define C_LOCALE "C"
#define OTHER_LOCALE "ko_KR.euc"

#ifndef MB_CUR_MAX
#define MB_CUR_MAX 4
#endif
 
void title()
{
  printf( "===== locale checker ==========\n" );

  printf( "** uname -msrv:\n" );
  system( "uname -msrv" );
  printf( "\n" );

  printf( "** locale type:\n" );
#ifndef X_LOCALE
  printf ( "LIBC_LOCALE\n" );
#else
  printf ( "X_LOCALE\n" );
#endif
  printf( "\n" );

#if defined(Linux_libc6) || defined(Linux_libc5)
  printf( "** ls -o /lib/libc.*:\n" );
  system( "ls -o /lib/libc.*" );
  printf( "\n" );
#endif

#ifdef X_LOCALE
  printf( "** xdpyinfo | grep ^vendor:\n" );
  system( "xdpyinfo | grep ^vendor" );
  printf( "\n" );
#endif

  printf( "** setlocale & mblen:\n" );
  system( "gcc -E lchk.c " CCOPT " " XINCDIR " | egrep \'(^.*char\\*.*locale.*=.*setlocale)|(^.*printf.*mblen\\()\'" );
  printf( "\n" );
}

void check(char* str)
{
  printf ("[%2d] %s\n", mblen(str, MB_CUR_MAX), str);
}

void chglocale(char* str)
{
  char* locale = setlocale(LC_ALL, str);
  printf ( "** TRY [%s], RETURN [%s], CURRENT[%s]\n",
	   str, locale ? locale : "(null)", setlocale(LC_ALL, NULL) );
#ifdef X_LOCALE
  if ( !XSupportsLocale() )
    printf( "locale not supported by Xlib\n" );
#endif
}

void main ()
{
  title();

  chglocale( "" );
  check( "漢字" );
  check( "ABC" );
  printf( "\n" );

  chglocale("C");
  check( "漢字" );
  check( "ABC" );
  printf( "\n" );

  chglocale( JP_LOCALE );
  check( "漢字" );
  check( "ABC" );
  printf( "\n" );

  chglocale( OTHER_LOCALE );
  check( "漢字" );
  check( "ABC" );
  printf( "\n" );
}


----Next_Part(Wed_Jun_24_12:56:41_1998_41)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

# -*- text -*-
XLIBDIR=/usr/X11R6/lib
XINCDIR=/usr/X11R6/lib

all::
	@echo plaese specify target.

lchk_linux_libc5: lchk.c
	gcc -g -Wall -o lchk_linux_libc5 lchk.c -DLinux_libc5 -DX_LOCALE -DXINCDIR=\"-I$(XINCDIR)\"  $(XLIBDIR)/libX11.so.6 libXlocale.a

lchk_linux_libc6: lchk.c
	gcc -g -Wall -o lchk_linux_libc6 lchk.c -DLinux_libc6

lchk_freebsd: lchk.c
	gcc -g -Wall -o lchk_freebsd lchk.c -DFreeBSD -lxpg4

lchk_solaris: lchk.c
	gcc -g -Wall -o lchk_solaris lchk.c -DSolaris

clean::
	-rm -f lchk_*



----Next_Part(Wed_Jun_24_12:56:41_1998_41)----