Subject: pkg/19689: wm/bsetroot nls catalog handling (setlocale) is broken
To: None <>
From: None <>
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
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 1.6K
System: NetBSD 1.6K NetBSD 1.6K (NT310S) #0: Sun Jan 5 01:29:32 JST 2003 i386
Architecture: i386
Machine: i386
	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/ 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/' as catalog path name ;)

	Run bsetroot with ktrace, and kdump | grep NAMI

	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 `' 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/	Wed May 15 17:33:42 2002
+++ src/	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, '.');