みんな「みーっつ! みんな笑顔で明るいあるぱ城!」
ルギア君「ガブちゃんとフロル君は?」
ロザリー「ガブちゃんが罰としてフロル君を彼が掘った洞穴の中に送り込んだんだけど、まだ戻ってこないんだって。」
ルギア君「…」
ロザリー「だからそれを見張っているから朝礼は行かないってさ。」
ルギア君「そうか…。」
ドンちゃん「それじゃあ、今日も仕事始め!」
……………………
ルギア君「しかたが無いからこの問題を解決するか。」
キリルン「メモリ・エラー、ですか。」
ルギア君「そうね。まあ、18ZB *1なんかどんなマシンにもないよな。というわけで gdb。調査済の結果。」
gdb
(gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /usr/bin/tex Breakpoint 1, main (ac=1, av=0x7fffffffdbb8) at texextra.c:796 796 { (gdb) c Continuing. Breakpoint 2, mainbody () at texini.c:3770 3770 { (gdb) Continuing. Hardware watchpoint 8: extramembot Old value = 0 New value = -268435455 0x0000000000402136 in initialize () at texini.c:119 119 mubytecswrite [i ]= -268435455L ; (gdb) Continuing. This is TeX, Version 3.1415926 (TeX Live 2010) Breakpoint 4, mainbody () at texini.c:4148 4148 scannerstatus = 0 ; (gdb) Continuing. **X Breakpoint 5, loadfmtfile () at texini.c:2705 2705 { (gdb) Continuing. Breakpoint 6, loadfmtfile () at texini.c:2807 2807 zeqtb = xmallocarray ( memoryword , eqtbtop + 1 ) ; (gdb) Continuing. Breakpoint 7, loadfmtfile () at texini.c:2816 2816 undumpint ( x ) ; (gdb) u 2817 if ( debugformatfile ) (gdb) 2822 if ( x != membot ) (gdb) 2824 undumpint ( memtop ) ; (gdb) 2825 if ( debugformatfile ) (gdb) 2830 if ( membot + 1100 > memtop ) (gdb) 2832 curlist .headfield = memtop - 1 ; (gdb) 2835 memmin = membot - extramembot ; (gdb) 2832 curlist .headfield = memtop - 1 ; (gdb) 2833 curlist .tailfield = memtop - 1 ; (gdb) 2834 pagetail = memtop - 2 ; (gdb) 2836 memmax = memtop + extramemtop ; (gdb) 2834 pagetail = memtop - 2 ; (gdb) 2835 memmin = membot - extramembot ; (gdb) 2836 memmax = memtop + extramemtop ; (gdb) 2837 yzmem = xmallocarray ( memoryword , memmax - memmin + 1 ) ; (gdb) fatal: memory exhausted (xmalloc of 18446744071586067984 bytes). Program exited with code 01. (gdb)
ルギア君「ウォッチポイントは extramembot に付いている。気になることは無いだろうか。」
キリルン「extramembot じゃないところで変更されているでゲソ!」
ルギア君「そう、そういうこと。で、この回りを調べてみると、こうなっている。」
texini.c
106 {register integer for_end; i = 0 ;for_end = 31 ; if ( i <= for_end) do 107 xchr [i ]= i ; 108 while ( i++ < for_end ) ;} 109 {register integer for_end; i = 127 ;for_end = 255 ; if ( i <= for_end) do 110 xchr [i ]= i ; 111 while ( i++ < for_end ) ;} 112 {register integer for_end; i = 0 ;for_end = 255 ; if ( i <= for_end) do 113 mubyteread [i ]= -268435455L ; 114 while ( i++ < for_end ) ;} 115 {register integer for_end; i = 0 ;for_end = 255 ; if ( i <= for_end) do 116 mubytewrite [i ]= 0 ; 117 while ( i++ < for_end ) ;} 118 {register integer for_end; i = 0 ;for_end = 128 ; if ( i <= for_end) do 119 mubytecswrite [i ]= -268435455L ; 120 while ( i++ < for_end ) ;} 121 mubytekeep = 0 ;
ルギア君「最後の 118 行目のループは i が 127 のとき、i++ で i は 128 になるけど、i++ は 127 を返すから i = 128 も回るね。」
キリルン「うむ。」
ルギア君「他のを見るとすぐピンとくるけど、他はみんな終了値が なのに、これだけ なんで、すごい気になるよな。」
キリルン「確かに…。」
ルギア君「それで宣言がどうなっているか見に行くわけ。このファイルが include しているのは texd.h だけだったのでそれを覗くと、」
texd.h
95 EXTERN ASCIIcode xchr[256] ; 96 EXTERN ASCIIcode xprn[256] ; 97 EXTERN halfword mubyteread[256] ; 98 EXTERN strnumber mubytewrite[256] ; 99 EXTERN halfword mubytecswrite[128] ; 100 EXTERN integer mubyteskip ; 101 EXTERN integer mubytekeep ;
133 EXTERN integer membot ; 134 EXTERN integer mainmemory ; 135 EXTERN integer extramembot ; 136 EXTERN integer memmin ; 137 EXTERN integer memtop ;
ルギア君「というようにやはり 128 で宣言されている。ここは宣言だから定義の順番は判らないけど、メモリで mubytecswrite の次にたまたま extramembot だったというわけなんだな。」
キリルン「なるほど。」
ルギア君「まあ、直すならあそこの for_end を 127 にすればいいと思うのだが、ただ、問題がいくつかあって。」
キリルン「何?」
ルギア君「今、見てきたソースはすべて何かで自動生成されたものということだ。」
キリルン「あー。」
ルギア君「まずは、texini.c のもとになると思われる texini.ch や texini.web があるかどうかは」
[lugia@arpa-castle web2c]$ pwd /opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c [lugia@arpa-castle web2c]$ find -name '*texini*' [lugia@arpa-castle web2c]$
ルギア君「まあ、ないわな。というわけで、grep もしてみる。」
[lugia@arpa-castle web2c]$ grep -R texini . # (結果は抜粋) ./am/texmf.am:tex_c_h = texini.c tex0.c texcoerce.h texd.h ./Makefile.in:tex_c_h = texini.c tex0.c texcoerce.h texd.h ./Makefile.in:@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tex-texini.Po@am__quote@ ./Makefile.in:tex-texini.o: texini.c ./Makefile.in:@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tex_CPPFLAGS) $(CPPFLAGS) $(tex_CFLAGS) $(CFLAGS) -MT tex-texini.o -MD -MP -MF $(DEPDIR)/tex-texini.Tpo -c -o tex-texini.o `test -f 'texini.c' || echo '$(srcdir)/'`texini.c ./Makefile.in:@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tex-texini.Tpo $(DEPDIR)/tex-texini.Po ./Makefile.in:@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='texini.c' object='tex-texini.o' libtool=no @AMDEPBACKSLASH@ ./Makefile.in:@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tex_CPPFLAGS) $(CPPFLAGS) $(tex_CFLAGS) $(CFLAGS) -c -o tex-texini.o `test -f 'texini.c' || echo '$(srcdir)/'`texini.c ./Makefile.in:tex-texini.obj: texini.c ./Makefile.in:@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tex_CPPFLAGS) $(CPPFLAGS) $(tex_CFLAGS) $(CFLAGS) -MT tex-texini.obj -MD -MP -MF $(DEPDIR)/tex-texini.Tpo -c -o tex-texini.obj `if test -f 'texini.c'; then $(CYGPATH_W) 'texini.c'; else $(CYGPATH_W) '$(srcdir)/texini.c'; fi` ./Makefile.in:@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tex-texini.Tpo $(DEPDIR)/tex-texini.Po ./Makefile.in:@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='texini.c' object='tex-texini.obj' libtool=no @AMDEPBACKSLASH@ ./Makefile.in:@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tex_CPPFLAGS) $(CPPFLAGS) $(tex_CFLAGS) $(CFLAGS) -c -o tex-texini.obj `if test -f 'texini.c'; then $(CYGPATH_W) 'texini.c'; else $(CYGPATH_W) '$(srcdir)/texini.c'; fi`
ルギア君「今ここに見えるのは、すべて C 言語のコンパイルだな。」
キリルン「そうでゲソね。」
ルギア君「次は make のログから漁ってみる。」
gcc -DHAVE_CONFIG_H -I. -I/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c -I./w2c -I/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/work/texk -I/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk -Wall -Wunused -Wimplicit -Wreturn-type -Wdeclaration-after-statement -Wno-unknown-pragmas -Wmissing-prototypes -Wmissing-declarations -Wparentheses -Wswitch -Wtrigraphs -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wold-style-definition -g -O2 -MT tex-texini.o -MD -MP -MF .deps/tex-texini.Tpo -c -o tex-texini.o `test -f 'texini.c' || echo '/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c/'`texini.c
ルギア君「しかしこのコンパイル以外に真新しい場所はない。」
キリルン「えっ。」
ルギア君「configure にもそれらしき記述はなし。仕方がないので最終奥義を使おうか。」
[lugia@arpa-castle web2c]$ pwd /opt/Momonga/pkgs/texlive/BUILD/texlive-2010/work/texk/web2c [lugia@arpa-castle web2c]$ ll -t | grep ' texini.c' -A1 -B1 -rw-r--r--. 1 lugia users 476598 8月 2 19:47 tex0.c -rw-r--r--. 1 lugia users 110758 8月 2 19:47 texini.c -rw-r--r--. 1 lugia users 10 8月 2 19:47 tex-web2c [lugia@arpa-castle web2c]$ stat texini.c File: `texini.c' Size: 110758 Blocks: 224 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427216 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 19:47:34.884561498 +0900 Modify: 2011-08-02 19:47:34.879561559 +0900 Change: 2011-08-02 19:47:34.879561559 +0900 Birth: - [lugia@arpa-castle web2c]$ stat tex0.c File: `tex0.c' Size: 476598 Blocks: 936 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427217 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 19:47:34.883561511 +0900 Modify: 2011-08-02 19:47:34.879561559 +0900 Change: 2011-08-02 19:47:34.879561559 +0900 Birth: - [lugia@arpa-castle web2c]$ stat tex-web2c File: `tex-web2c' Size: 10 Blocks: 8 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427213 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-03 08:38:24.672359581 +0900 Modify: 2011-08-02 19:47:34.632564648 +0900 Change: 2011-08-02 19:47:36.894536370 +0900 Birth: - [lugia@arpa-castle web2c]$
ルギア君「ext4 がナノ秒対応で良かったよ。もう少し前を見てみようか。」
[lugia@arpa-castle web2c]$ ll -t | grep ' texini.c' -B3 -rw-r--r--. 1 lugia users 24602 8月 2 19:47 pdftexd.h -rw-r--r--. 1 lugia users 76869 8月 2 19:47 pdftexcoerce.h -rw-r--r--. 1 lugia users 476598 8月 2 19:47 tex0.c -rw-r--r--. 1 lugia users 110758 8月 2 19:47 texini.c [lugia@arpa-castle web2c]$ stat pdftexcoerce.h File: `pdftexcoerce.h' Size: 76869 Blocks: 152 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427209 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 19:48:08.213144832 +0900 Modify: 2011-08-02 19:47:35.611552410 +0900 Change: 2011-08-02 19:47:35.611552410 +0900 Birth: -
ルギア君「これは確実に別だね。」
[lugia@arpa-castle web2c]$ ll -t | grep ' texini.c' -A3 -rw-r--r--. 1 lugia users 110758 8月 2 19:47 texini.c -rw-r--r--. 1 lugia users 10 8月 2 19:47 tex-web2c -rw-r--r--. 1 lugia users 10225254 8月 2 19:47 libluatex.a -rw-r--r--. 1 lugia users 16658 8月 2 19:47 eptexd.h [lugia@arpa-castle web2c]$ stat libluatex.a File: `libluatex.a' Size: 10225254 Blocks: 19976 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427212 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 19:48:18.403017443 +0900 Modify: 2011-08-02 19:47:34.452566899 +0900 Change: 2011-08-02 19:47:34.552565648 +0900 Birth: -
ルギア君「アーカイブでもあるし、これも完全に別だね。さてじゃあ、もうひとつ。」
[lugia@arpa-castle web2c]$ ll -t | grep ' texd.h' -A3 -B3 -rw-r--r--. 1 lugia users 128370 8月 2 19:47 etexini.c -rw-r--r--. 1 lugia users 10 8月 2 19:47 etex-web2c -rwxr-xr-x. 1 lugia users 5793 8月 2 19:47 mpost -rw-r--r--. 1 lugia users 15673 8月 2 19:47 texd.h -rw-r--r--. 1 lugia users 40879 8月 2 19:47 texcoerce.h -rw-r--r--. 1 lugia users 498126 8月 2 19:47 mf0.c -rw-r--r--. 1 lugia users 31143 8月 2 19:47 mfini.c [lugia@arpa-castle web2c]$ stat texd.h File: `texd.h' Size: 15673 Blocks: 32 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427215 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 19:48:21.712976061 +0900 Modify: 2011-08-02 19:47:36.891536406 +0900 Change: 2011-08-02 19:47:36.891536406 +0900 Birth: - [lugia@arpa-castle web2c]$ stat texcoerce.h File: `texcoerce.h' Size: 40879 Blocks: 80 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427214 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 19:48:21.765975400 +0900 Modify: 2011-08-02 19:47:36.889536432 +0900 Change: 2011-08-02 19:47:36.889536432 +0900 Birth: - [lugia@arpa-castle web2c]$ stat mf0.c File: `mf0.c' Size: 498126 Blocks: 976 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427222 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 19:47:35.846549472 +0900 Modify: 2011-08-02 19:47:35.843549508 +0900 Change: 2011-08-02 19:47:35.843549508 +0900 Birth: - [lugia@arpa-castle web2c]$ stat mpost File: `mpost' Size: 5793 Blocks: 16 IO Block: 4096 通常ファイル Device: fd00h/64768d Inode: 3427224 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 500/ lugia) Gid: ( 100/ users) Context: unconfined_u:object_r:usr_t:s0 Access: 2011-08-02 20:00:25.730924592 +0900 Modify: 2011-08-02 19:47:37.128533443 +0900 Change: 2011-08-02 19:47:37.130533419 +0900 Birth: -
ルギア君「後ろはかなり近いけど、バイナリファイルだからたぶん違うね。まとめると、」
キリルン「まとめると?」
ルギア君「texini.c は tex0.c を作った時の副産物である。texd.h は texcoerce.h といっしょに出来たものみたい。」
キリルン「なるほどでゲソ。」
ルギア君「ちなみに、」
tex.p (Pascal ソース)
[lugia@arpa-castle web2c]$ nl -ba tex.p | grep ' 234[^0-9]' -A1 -B4 230 xchr[124]:='|';xchr[125]:='}';xchr[126]:='~'; 231 {:21}{23:}for i:=0 to 31 do xchr[i]:=i;for i:=127 to 255 do xchr[i]:=i; 232 for i:=0 to 255 do mubyteread[i]:=-268435455; 233 for i:=0 to 255 do mubytewrite[i]:=0; 234 for i:=0 to 128 do mubytecswrite[i]:=-268435455;mubytekeep:=0; 235 mubytestart:=false;writenoexpanding:=false;csconverting:=false;
ルギア君「Pascal ソースは ctangle ではなく c のない tangle で書き出されるから、ctangle に問題があるわけではない。」
キリルン「両方に問題がある可能性は?」
ルギア君「まあ、ないわけではないが、別に作られたプログラムだから、それは無いだろう。」
キリルン「…」
ルギア君「さらに、ちなみに、etex の Pascal ソース、」
etex.p (Pascal ソース)
[lugia@arpa-castle web2c]$ nl -ba etex.p | grep ' 250[^0-9]' -A1 -B4 246 xchr[126]:='~';{:21}{23:}for i:=0 to 31 do xchr[i]:=i; 247 for i:=127 to 255 do xchr[i]:=i; 248 for i:=0 to 255 do mubyteread[i]:=-268435455; 249 for i:=0 to 255 do mubytewrite[i]:=0; 250 for i:=0 to 128 do mubytecswrite[i]:=-268435455;mubytekeep:=0; 251 mubytestart:=false;writenoexpanding:=false;csconverting:=false;
キリルン「あれ?」
ルギア君「なんと、実は tex 以外もオーバーライトしていることが発覚した。tex でたまたまその次のアドレスの値が確保するメモリの個数に使われているためにエラーとなったということだ。」
キリルン「なるほど。」
ルギア君「宣言はやはり」
mubytecswrite:array[0..127]of halfword;mubyteskip:integer;
ルギア君「で、127 までのようである。ちなみに ptex 系にはこの名前の変数は使われていない模様。」
キリルン「ふむふむ。」
まとめ
ルギア君「さて、話を戻そう。tex0.c もやはり探してみたが、みつからない。どうやら、(c)tangle で勝手に決める名前らしい。」
キリルン「ふむふむ。」
ルギア君「調べたところ、ビルドの手順はまず、tie で tex.web、tex.ch、tex-binpool.ch から tex-final.ch を作る。」
WEBINPUTS=.:/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c TEXMFCNF=/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c/../kpathsea ./tie -c tex-final.ch tex.web tex.ch tex-binpool.ch This is TIE, CWEB Version 2.4. (TeX Live 2010) Copyright (c) 1989,1992 by THD/ITI. All rights reserved. (tex.web) (tex.ch) (tex-binpool.ch) ....500....1000....1500....2000....2500....3000....3500....4000....4500....5000....5500....6000....6500....7000....7500....8000....8500....9000....9500....10000....10500....11000....11500....12000....12500....13000....13500....14000....14500....15000....15500....16000....16500....17000....17500....18000....18500....19000....19500....20000....20500....21000....21500....22000....22500....23000....23500....24000....24500.... (No errors were found.)
ルギア君「そして、tex.web と tex-final.ch から tex0.c と texini.c が作られる、というわけだ。」
WEBINPUTS=.:/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c TEXMFCNF=/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c/../kpathsea ./tangle tex tex-final This is TANGLE, Version 4.5 (TeX Live 2010) *1*11*19*29*36*55*63*65*70*93*108*121*132*139*144*183*200*218*239*258*261*264*271 Writing the output file.....500.....1000.....1500. Done. (No errors were found.)
ルギア君「で、etex の場合はどうなっているか、というと、まず、etex.web、tex.web、etex.ch、etex.fix から etex.web をつくる。」
WEBINPUTS=.:/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c TEXMFCNF=/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c/../kpathsea ./tie -m etex.web tex.web etexdir/etex.ch etexdir/etex.fix This is TIE, CWEB Version 2.4. (TeX Live 2010) Copyright (c) 1989,1992 by THD/ITI. All rights reserved. (tex.web) (etexdir/etex.ch) (etexdir/etex.fix) ....500....1000....1500....2000....2500....3000....3500....4000....4500....5000....5500....6000....6500....7000....7500....8000....8500....9000....9500....10000....10500....11000....11500....12000....12500....13000....13500....14000....14500....15000....15500....16000....16500....17000....17500....18000....18500....19000....19500....20000....20500....21000....21500....22000....22500....23000....23500....24000....24500.... (No errors were found.)
ルギア君「そして、etex.web と etex.ch から etex0.c と etexini.c を作る。」
WEBINPUTS=.:/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c TEXMFCNF=/opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c/../kpathsea ./tangle etex etex This is TANGLE, Version 4.5 (TeX Live 2010) *1*366*17*405*25*39*55*467*73*490*514*100*542*111*116*134*586*168*595*179*205*209*213*647*217*226*683*702*722*262*274*771*295*303*306*816*327*338*865*374*894*413*903*922*945*475*498*970*522*983*550*1032*1058*594*603*1139*1211*655*691*710*1302*730*1333*1341*1343*779*1382*824*873*902*911*930*953*1603*1612*1614*978*1626*991*1635*1670*1673 Writing the output file.....500.....1000.....1500.....2000.....2500.....3000.....3500.....4000.....4500.....5000.....5500.....6000.....6500.....7000.....7500.....8000... Done. 1205 strings written to string pool file. (No errors were found.)
ルギア君「(並行ビルドしてるからちょっと他のが混ざって出力おかしいけど) というわけだ。共通するソースは?」
キリルン「tex.web でゲソ。」
ルギア君「そういうことになる。まあ、直接なおしてもいいんだけど、明らかにそっち直した方がいいよな。でも僕 WEB は読めないよ〜。」
キリルン「まあ、がんばれでゲソ。」
ルギア君「ソースがわかったならそれでもいいんだが、実は、」
[lugia@arpa-castle web2c]$ pwd /opt/Momonga/pkgs/texlive/BUILD/texlive-2010/texlive-20100722-source/texk/web2c [lugia@arpa-castle web2c]$ grep -R extramembot . [lugia@arpa-castle web2c]$ grep -R mubytecswrite . [lugia@arpa-castle web2c]$
ルギア君「というようにそんな名前はどこにも使われていない。すこし短くして調べてみたら」
[lugia@arpa-castle web2c]$ grep -R mubyte . | head ./texmfmp-help.h.ptexfam: "-enc enable encTeX extensions such as \\mubyte", ./texmfmp-help.h.ptexfam: "-enc enable encTeX extensions such as \\mubyte", ./texmfmp-help.h.ptexfam: "-enc enable encTeX extensions such as \\mubyte", ./ptexdir/ptex-base.ch.110223_radical:mubyte_read: array [ASCII_code] of pointer; ./ptexdir/ptex-base.ch.110223_radical:mubyte_write: array [ASCII_code] of str_number; ./ptexdir/ptex-base.ch.110223_radical:mubyte_cswrite: array [0..127] of pointer; ./ptexdir/ptex-base.ch.110223_radical:mubyte_skip: integer; { the number of bytes to skip in |buffer| } ./ptexdir/ptex-base.ch.110223_radical:mubyte_keep: integer; { the number of chars we need to keep unchanged } ./ptexdir/ptex-base.ch.110223_radical:mubyte_skeep: integer; { saved |mubyte_keep| } ./ptexdir/ptex-base.ch.110223_radical:mubyte_prefix: integer; { the type of mubyte prefix }
ルギア君「で、元の名前には _ が入っていたことがわかり、調べてみたら、」
[lugia@arpa-castle web2c]$ grep -R mubyte_cswrite tex.web [lugia@arpa-castle web2c]$ grep -R mubyte_cswrite tex.ch mubyte_cswrite: array [0..127] of pointer; for i:=0 to 128 do mubyte_cswrite[i]:=null; few control sequences will need to be converted. So |mubyte_cswrite|, q := mubyte_cswrite [p mod 128] ; p := mubyte_cswrite [cur_cs mod 128]; p := mubyte_cswrite [cur_cs mod 128]; r := mubyte_cswrite[(mubyte_stoken-cs_token_flag) mod 128]; mubyte_cswrite[(mubyte_stoken-cs_token_flag) mod 128] := p; p := mubyte_cswrite [cs mod 128]; else mubyte_cswrite[cs mod 128] := link (link (p)); dump_things(mubyte_cswrite[0], 128); undump_things(mubyte_cswrite[0], 128); [lugia@arpa-castle web2c]$
ルギア君「あ、それっぽいのがあるじゃなイカ。」
キリルン「よかったじゃなイカ。」
ルギア君「これ修正してうまく行けばいいがな…。」
参考
ルギア君「etex や pdftex で問題を起こさなかったのは、」
(gdb) p &extramembot $2 = (integer *) 0x664a44 (gdb) p &mubytecswrite[128] $4 = (halfword *) 0x664a40 (gdb)
(etex の場合)
ルギア君「と見事にずれたからである。ただ、確実に言えることは代りのものがなにか犠牲になっている。fmtutil でやる tex.fmt を作る時に /usr/bin/tex は実行されているが、initex の時はここを通らないので、問題にならない。」
*1:ゼタバイト