発端は久々にIRCでもと思ってxchatをデスクトップのメニュー(当時はfluxboxだったような)からxchatを選択しても起動しなかったのがきっかけ。
起動失敗した理由が得られなかったのでコマンドラインから打てば分かるだろうということで、
コマンドラインから起動を試す。
[masami@moon:~]% /usr/bin/xchat XChat CRITICAL *** default event text failed to build! zsh: abort (core dumped) /usr/bin/xchat [masami@moon:~]%
予想通りというか、まあ、コア吐いて死ぬ・゚・(つД`)・゚・ ウェ
自分はDebian使いだし、ソースからxchatをインストールしたわけではないので、まずはstraceで確認。
close(6) = 0 munmap(0x2b66e9b59000, 4096) = 0 open("/usr/share/pixmaps/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/X11R6/lib/X11/icons/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/masami/.icons/Industrial/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/masami/.icons/Industrial/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/icons/Industrial/cursors/xterm", O_RDONLY) = 6 fstat(6, {st_mode=S_IFREG|0644, st_size=2368, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b66e9b59000 read(6, "Xcur\20\0\0\0\0\0\1\0\1\0\0\0\2\0\375\377\30\0\0\0\34\0"..., 4096) = 2368 lseek(6, 0, SEEK_SET) = 0 read(6, "Xcur\20\0\0\0\0\0\1\0\1\0\0\0\2\0\375\377\30\0\0\0\34\0"..., 4096) = 2368 close(6) = 0 munmap(0x2b66e9b59000, 4096) = 0 write(2, "XChat CRITICAL *** default event"..., 55XChat CRITICAL *** default event text failed to build! ) = 55 rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0 tgkill(14304, 14304, SIGABRT) = 0 --- SIGABRT (Aborted) @ 0 (0) --- +++ killed by SIGABRT (core dumped) +++ Process 14304 detached
しかし、これでは全く理由がわかんなかったんです。ここで一旦デビアンのBTSへバグ報告。
そしらた返信があって旧バージョンあるから試してくれと言われたので、拾ってきてテスト。
しばらくは先のメールの人とやりとりをしつつ、原因を探し。
in text.c:pevent_make_pntevts(). when i is 104 pevt_build_string() return 1. this is the arguments of pevt_build_string(). pevt_build_string (input=0x5d6760 "%C28-%C29$1/Wallops%C28-%O$t$", output=0x5889e0, max_arg=0x7fffbfd518bc) at text.c:1440 in text.c:pevt_build_string() 1487:if (ii == len) 1488:{ 1499: fe_message ("String ends with a $", FE_MSG_WARN); 1450: return 1; 1451:}
コアを吐くのは1450行目で1を返してその結果としてコアを吐きにいってた(だったはず)。
その後、旧バージョンのソースとコア吐くバージョンのソースのdiffを取ったりしつつしてたら、
おっ!っと思う変更点を発見。
in text.c:pevent_make_pntevts() I think line 1145 is cause of core dump. 1141:/* make-te.c sets this 128 flag (DON'T call gettext() flag) */ 1142:if (te[i].num_args & 128) 1143: pntevts_text[i] = strdup (te[i].def); 1144:else 1145: pntevts_text[i] = strdup (_(te[i].def)); I get diff from text.c. then i noticed that pevent_make_pntevts() was changed. version 2.6.4 pevent_make_pntevts() didn't use gettext() . I used this command line to don't use gettext(). then it works. [masami@moon:~]% LC_MESSAGES=C xchat
気づいた人もいると思いますが、1145行目のstrdup()に渡す引数は下の用にgettext()を使ってたんです。
_(te[i].def)
"_(文字列)"はgettext()で使われるパターンですよね。
gettext()を使うかどうかをif文で判断してるってことは、アレだなと気づいて(゚ロ゚;)ハッ!!
[masami@moon:~]% LC_MESSAGES=C xchat
上のように実行したらxchatが普通立ち上がるじゃないですか(*゚▽゚)ノ
これでだいたいバグの場所が見えてきたので、次にしたのは多分、落ちたときのte[i].defの値を調べたんだと思います。
それで、ja.poからte[i].defに該当する値を調べ、旧バージョンとのdiffを取ったりして下のパッチ作ることができたと(〃´o`)=3 フゥ
--- xchat.old/xchat-2.6.8/po/ja.po 2006-10-16 23:53:56.000000000 +0900 +++ xchat.new/xchat-2.6.8/po/ja.po 2006-11-07 23:47:01.000000000 +0900 @@ -1082,7 +1082,7 @@ #: src/common/textevents.h:318 msgid "%C28-%C29$1/Wallops%C28-%O$t$2" -msgstr "%C28-%C29$1/Wallops%C28-%O$t$" +msgstr "%C28-%C29$1/Wallops%C28-%O$t$2" #: src/common/textevents.h:321 #, fuzzy
補足:
なんでこうなったかっていうと、「%C28-%C29$1/Wallops%C28-%O$t$」をja.poから探して見つかんなかったので、
xchatは起動するのをあきらめて、アボートしにいってたわけですorz