2008年1月15日火曜日

send-prしてみる。(mh編)


とりあえず先に進むことにする。
本当なら porttools-0.77 と nbsmtp-1.00 で快適send-pr、の予定だったのですが、
主にネットワーク上の都合によりWebから送付、ということにします。
まずはports全体のpatch作りから、ふたたび。


  1. make update で取り込んだオリジナルの /usr/ports/japanese/mh を、一旦 /usr/ports/japanese/mh.orig にコピー。
  2. /usr/ports/japanese/mh を改めて一から修正。(このへんは過去とったdiffを活用)
  3. port test -l でチェックする。warningが出る……

    WARN: /usr/ports/japanese/mh/pkg-plist: [74]: If and only if your port is
    DOCSDIR-safe (that is, a user can override DOCSDIR when building this port
    and the port will still work correctly) consider using DOCSDIR macro;
    if you are unsure if this this port is DOCSDIR-safe, then ignore this warning

    DOCSDIRを変えても問題はないか、って?
    Makefileには DOCDIR なんてのがあるんだけど、ちょっと違うようなので、
    ここでは見過ごすことにします。(ツッコミ歓迎)
  4. port diff -d .orig | gzip -c > /tmp/ja-mh.080115.diff.gz (オリジナルのディレクトリとdiffをとります。)
  5. cd /tmp/
  6. uuencode ja-mh.080115.diff.gz ja-mh.080115.diff.gz > ja-mh.080115.uu.txt


ということで送るファイルは出来ました。(このパッチには一部Ctrl+Lが
含まれているので、このようにして送るのが安全みたい。)

さて、send-prしてみます。

http://www.freebsd.org/send-pr.html
(なぜか日本語のページからsend-prしようとするとCAPTCHA風味のところで
正しい入力ではない、と撥ねられてしまうので、本家版のほうからやります。)

一部を転載。



One line summary of the problem: [PATCH] japanese/mh for gcc 4.2 on FreeBSD 7.0
: ports
: non-critical
: low

:
I modified this ports to compile with gcc 4.2 on FreeBSD 7.0.
Please review and consider applying the following patch.
(あやしい英語だ!)
:
ここにさきほどuuencodeしたpatchを読ませる。
Finally, please enter the code from the image below to prove you're not a robot:
(CAPTCHA風味の英数字入力をして・・・)


Submit!

Thank you!

おわり。

しばらくするとsend-prした内容を受け付けた旨のメールが届きます。

手順がおかしいところがあったらコメントいただけると幸いです。

次の目標は
http://www.otsune.com/bsd/ports/install_as_user.html
http://uyota.asablo.jp/blog/2006/02/15/254777
これだな……

2008年1月11日金曜日

募集:ja-plain2がbrokenだったけどなおしてみた。

こんな感じで一応解決?




--- src/macro.h.org 2008-01-11 01:36:11.000000000 +0900
+++ src/macro.h 2008-01-11 01:33:10.000000000 +0900
@@ -2,6 +2,8 @@
* Copyright (C) 1992,1993 NEC Corporation.
* $Id: macro.h,v 2.6 1994/04/19 10:16:49 uchida Exp $ (NEC)
*/
+#define MAX_MACRO_LEN 320
+
#define MACRO_MAXARG 10

#define M_DOC_BEGIN 0
@@ -74,5 +76,5 @@

struct macDefs {
int mdef_number;
- char *mdef_def;
+ char mdef_def[MAX_MACRO_LEN];
};



これでとりあえずTeX, HTMLへの変換動作はうまくいってます。
本当ならヘッダ部の怪しいところ全部、ちゃんと配列に置き換えるべきなのかもしれません。



http://www1.odn.ne.jp/taraijpn/japanese_plain2_20080111.diff.txt
http://www1.odn.ne.jp/taraijpn/japanese_plain2_20080111.tar.gz



portsにしたのでとりあえず、動作確認してくれる人を募集します。
FreeBSD関係ない部分とそうでない部分に分ければLinuxのパッケージにも入れられるかな。
分けてくれる人も大募集。

2008年1月10日木曜日

続:ja-plain2が……

結論: portsっていうレベルじゃないぞ!?

とりあえずデバッグしてみましょう。


--- plain2.org/Makefile 2008-01-09 21:35:05.000000000 +0900
+++ plain2/Makefile 2008-01-09 23:51:01.000000000 +0900
@@ -22,15 +22,11 @@
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:R}p${PORTVERSION:E}.orig
BUILD_WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:R}p${PORTVERSION:E}.orig/src

-MAKE_ARGS= CC="${CC}" CFLAGS="${CFLAGS} -DBSD -DKANJI -DPICTURE -DHTML -fwritable-strings"
+MAKE_ARGS= CC="${CC}" CFLAGS="-g -DBSD -DKANJI -DPICTURE -DHTML"
ALL_TARGET= ${PORTNAME}

.include

-.if ${OSVERSION} >= 700042
-BROKEN= Broken with gcc 4.2
-.endif
-
post-patch:
@${REINPLACE_CMD} -e \
's|/usr/lib/plain2|${DATADIR}|g' ${BUILD_WRKSRC}/plain2.h


まあわざわざ書くまでもないところですか。


vmbsd7# make
(中略)
cc -g -DBSD -DKANJI -DPICTURE -DHTML -o plain2 plain2.o readfile.o miscutil.o section.o example.o list.o plaintxt.o spacing.o headfoot.o hint.o justify.o texout.o output.o renumout.o macro.o htmlout.o roffout.o analyze.o table.o title.o picture.o ftitle.o


順当順当。


vmfbsd7# cd work/plain2-2.54p1.orig/src/
vmfbsd7# gdb ./plain2
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 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-marcel-freebsd"...
(gdb) run -tex ./plain2.h

Starting program: /usr/ports/japanese/plain2/work/plain2-2.54p1.orig/src/plain2 -tex ./plain2.h

Program received signal SIGSEGV, Segmentation fault.
0x0805253d in macroParse (
s=0x805affd "$2]{j-article}\n\\else\\documentstyle[$3]{jarticle}\\fi\n\\setcounter{secnumdepth}{6}\n\\setcounter{tocdepth}{6}\n\\topsep=0.1cm\n\\parsep=0.1cm\n\\itemsep=0.0cm\n%\\renewcommand{\\bf}{\\protect\\pbf\\protect\\pdg}\n\\begin"..., macroNum=0,
orig=0x805af98 "\\newif\\ifNTT\\NTTfalse\n\\ifx\\gtfam\\undefined\\ifx\\gtfamily\\undefined\\NTTtrue\\fi\\fi\n\\ifNTT\\documentstyle[$2]{j-article}\n\\else\\documentstyle[$3]{jarticle}\\fi\n\\setcounter{secnumdepth}{6}\n\\setcounter{tocdept"...) at macro.c:121
121 *s = '\0';
(gdb)


macro.c で、ポインタsが指してる先に '\0' を書こうとしてますね。
んでそれは文字列の一部、と。え、文字列?


(gdb) list
116 != def_type) {
117 fprintf(stderr,"Improper argtype in \"%s %s\"\n",
118 macNames[macroNum].mname_name, orig);
119 exit(1);
120 }
121 *s = '\0';
122 if (*(s + 2) == '\0')
123 return mip;;
124 new_mip->cmac_next = macroParse(s + 2, macroNum, orig);
125 break;


これでは分からない……。該当する文字列はどこで設定しているか、macro.c を見てみると、


28 struct macDefs texMacros[] = {
29 M_DOC_BEGIN, STR_DOC_BEGIN,
30 M_DOC_END, "\\end{document}\n",
31 M_PLAIN_BEGIN, "\\par\n",
32 M_PLAIN_END, "",


とかやっていて、STR_DOC_BEGIN にあの長ったらしい文字列がdefineされていました。
で、macDefsの定義はというと、grep したらば macro.h にあるという。曰く、


75 struct macDefs {
76 int mdef_number;
77 char *mdef_def;
78 };


こ、これではダメだ……書けるはずがない。というかこれを無理やり? 書けるようにするためのコンパイルオプションが -fwritable-strings だった、というわけですね。

えー、これ直すのー?(実はすぐ直せるんだけど…)