Subject: pkg/19689: wm/bsetroot nls catalog handling (setlocale) is broken
To: None <gnats-bugs@gnats.netbsd.org>
From: None <FUKAUMI.Naoki@crusoe.naobsd.org>
List: netbsd-bugs
Date: 01/05/2003 17:16:45
>Number:         19689
>Category:       pkg
>Synopsis:       wm/bsetroot nls catalog handling (setlocale) is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 05 00:19:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 1.6K
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD crusoe.naobsd.org 1.6K NetBSD 1.6K (NT310S) #0: Sun Jan 5 01:29:32 JST 2003 fun@nforce.naobsd.org:/usr/obj/i386/sys/arch/i386/compile/NT310S i386
Architecture: i386
Machine: i386
>Description:
	bsetroot says `failed to open catalog, using default messages'

	setlocale(LC_ALL, "") return value is different between our
	implementation and what bsetroot expect.

	e.g.) LANG=ja_JP.eucJP
		our impl: C/ja_JP.eucJP/C/C/C/ja_JP.eucJP
		bsetroot: ja_JP.eucJP@foobar

	bsetroot::src/i18n.cc use these strings to get catalog path name
	with these pre-proccessing:
	  1. remove first `@' and trailing strings
	  2. remove first `.' and trailing strings

	So we get `.../nls/C/ja_JP/blackbox.cat' as catalog path name ;)

>How-To-Repeat:
	Run bsetroot with ktrace, and kdump | grep NAMI

>Fix:
	Adhoc patch.

	XXX wm/blackbox also has similar problem.
	XXX I don't use blackbox. this patch is only tested for bsetroot.

	XXXXXX bsetroot use `blackbox.cat' which is provided by blackbox
	XXXXXX package. so if you don't install wm/blackbox, bsetroot
	XXXXXX says forever `failed to open catalog...' after this patch!

--- src/i18n.cc.orig	Wed May 15 17:33:42 2002
+++ src/i18n.cc	Sun Jan  5 02:13:27 2003
@@ -69,6 +69,7 @@
     if (MB_CUR_MAX > 1)
       mb = True;
     // truncate any encoding off the end of the locale
+    locale = setlocale(LC_MESSAGES, "");
     char *l = strchr(locale, '@');
     if (l) *l = '\0';
     l = strchr(locale, '.');
>Release-Note:
>Audit-Trail:
>Unformatted: