2004/03/01(Mon)
○ (略
@citrus gettext/libintl
むう。
bash-2.05b$ LANG=ja gdb fetchmail
GNU gdb 5.3nb1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...(no debugging symbols found)...
(gdb) run
Starting program: /usr/pkg/bin/fetchmail
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x48226b16 in strcasecmp () from /usr/lib/libc.so.12
(gdb) bt
#0 0x48226b16 in strcasecmp () from /usr/lib/libc.so.12
#1 0x48092ff6 in __gettext_iconv () from /usr/lib/libintl.so.0
#2 0x48092e24 in dcngettext () from /usr/lib/libintl.so.0
#3 0x48091f0b in gettext () from /usr/lib/libintl.so.0
#4 0x08064661 in free ()
#5 0x080518e5 in free ()
#6 0x0804a802 in free ()
(gdb)
gdbで追ってみると
Breakpoint 2, __gettext_iconv (origmsg=0x4826e15a "アカウント %s , サーバ %s",
db=0x8081000) at /usr/src/lib/libintl/gettext_iconv.c:108
108 const char *fromcode = db->mohandle.mo.mo_charset;
(gdb) s
118 int savederrno = errno;
(gdb) p fromcode
$1 = 0x0
(gdb)
で既にfromcodeが(ガッ、な状態。
@で結局のところ
msgunfmt /usr/pkgsrc/share/locale/ja/LC_MESSAGES/fetchmail.mo
してみると、例の GNU gettext拡張 である
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=EUC-JP\n"
"Content-Transfer-Encoding: 8bit\n"
が無い、旧(つか元々のSunOS gettext)形式のmessage catalogだというオチ。
@
*.moにcharset指定が無い場合
- 無変換(だから化けるかもよ)
- エンコーディングを自動判定
の2つが考えられるけど、
http://www.openi18n.org/docs/html/LI18NUX-2000-amd4.htm 読んだ限りでは
前者でいいみたいね、なんでpatch。
Index: gettext_iconv.c
===================================================================
RCS file: /home/cvs/NetBSD/src/lib/libintl/gettext_iconv.c,v
retrieving revision 1.4
diff -u -r1.4 gettext_iconv.c
--- gettext_iconv.c 20 Jan 2004 12:04:48 -0000 1.4
+++ gettext_iconv.c 1 Mar 2004 21:10:43 -0000
@@ -144,7 +144,7 @@
* shortcut if possible.
* XXX should handle aliases
*/
- if (!strcasecmp(tocode, fromcode))
+ if (fromcode == NULL || !strcasecmp(tocode, fromcode))
return origmsg;
/* XXX LOCK */