This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

wcsmbsload ignore lowercase charset alias


>Submitter-Id:	net
>Originator:	Shinya Hanataka
>Organization:  no
>Confidential:	no
>Synopsis:	wcsmbsload ignore lowercase charset alias
>Severity:	non-critical
>Priority:	high
>Category:	libc
>Class:		sw-bug
>Release:	libc-2.1
>Environment:
	PC-clone, pentium CPU, Linux 2.2.1
Host type: i586-pc-linux-gnu
System: Linux chaos 2.2.1 #18 SMP Mon Feb 15 23:06:41 JST 1999 i586 unknown
Architecture: i586

Addons: crypt linuxthreads
Build CFLAGS: -O3 -mpentium
Build CC: gcc
Compiler version: pgcc-2.91.60 19981201 (egcs-1.1.1 release)
Kernel headers: 2.2.1
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio

>Description:
	Traditionaly some Japanese uses lowercase codeset name "ujis",
	"eucJP" etc, and codeset name is compared case insensitive.

	if LANG envrionment variable have lowercase codeset name like
	ja_JP.ujis, and __wcsmbs_load_conv() called, extract_charset_name
	macro return lowercase string like "ujis", then 
	getfct("ujis", "INTERNAL//") and  getfct("INTERNAL", "ujis//") called. 

	But from 2.0.112, add_alias() covert all alias name to uppercase,
	__gconv_alias_compare() use case dependent search(strcmp).

	So __gconv_find_transform() always fail.

>How-To-Repeat:
/usr/lib/gconv/gconv-modules has:
alias   UJIS//                  EUC-JP//
module  EUC-JP//                INTERNAL                EUC-JP          1
module  INTERNAL                EUC-JP//                EUC-JP          1

LANG environment      setlocale/mbstowcs result
ja_JP.EUC-JP          OK   (EUC-JP.so is loaded)
ja_JP.euc-jp          OK   (EUC-JP.so is loaded)
ja_JP.UJIS            OK   (EUC-JP.so isloaded)
ja_JP.ujis            fail (EUC-JP.so is NOT loaded)

>Fix:
Next patch force convert codeset name in LANG to uppercase before
calling __gconv_find_transform;

--- wcsmbs/wcsmbsload.c.orig	Thu Mar  4 00:41:02 1999
+++ wcsmbs/wcsmbsload.c	Thu Mar  4 00:59:19 1999
@@ -21,6 +21,7 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 #include <locale/localeinfo.h>
 #include <wcsmbsload.h>
@@ -173,6 +174,12 @@
 
 	  /* Add the slashes necessary for a complete lookup.  */
 	  complete_name = add_slashes (charset_name);
+
+	  /* convert complete name to uppercase before search */
+	  {
+	    char *p = (char*) complete_name;
+	    while(*p) { *p = toupper(*p); *p++; }
+	  }
 
 	  __wcsmbs_gconv_fcts.tomb = getfct (complete_name, "INTERNAL");
 	  __wcsmbs_gconv_fcts.towc = getfct ("INTERNAL", complete_name);

-- 
HANATAKA, Shinya  <hanataka@abyss.rim.or.jp>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]