[debian-devel:18984] Re: [debian-devel:18979] packaging freewnn (was: Fre eWnn の source に関してご意見を求めます)

Mitsutoshi NAKANO <[email protected]>
Newsgroups gmane.linux.debian.jp.devel
Message-ID <CANW2+itarEJCUAN-X4OPJpxhhAVmNg6_3Z2UUqTRfTtirjdMdQ@mail.gmail.com>
この mail は
TO [email protected]
CC [email protected]

お久しぶりです。

FreeWnn の Debian package を更新する件ですが、
現在も Debian unstable の上で作業を続けております。


そこで気づいたのですが、今の build system は昔よりも
printf() 系 functions の error check が厳しくなったようです。

printf(STRING) だけだと compile error が
出るようになっています。

(f)printf() に関しては printf("%s", STRING) となるように patch
を書きました。

しかし、今度は print_msg_getc() という FreeWnn の function で
error を指摘され、 patch の必要があります。


$gbp buildpackage --git-ignore-branch -uc -us
...
gcc -g -O2 -fstack-protector-strong -Wformat -Werror=format-security  -D_FORTIF\
Y_SOURCE=2 -Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H\
 -I../..  -I../../Wnn/include -I../../Wnn/romkan -DLIBDIR=\"/usr/share/wnn\" -D\
JAPANESE -D_FORTIFY_SOURCE=2  -c -o touroku.o touroku.c
touroku.c: In function 'touroku':
touroku.c:110:7: error: format not a string literal and no format arguments [-W\
error=format-security]
       print_msg_getc (MSG_GET (42));
       ^
touroku.c:131:7: error: format not a string literal and no format arguments [-W\
error=format-security]
        print_msg_getc (MSG_GET (43));
        ^
touroku.c:152:7: error: format not a string literal and no format arguments [-W\
error=format-security]
        print_msg_getc (MSG_GET (44));
        ^
cc1: some warnings being treated as errors
<builtin>: recipe for target 'touroku.o' failed
make[3]: *** [touroku.o] Error 1
make[3]: Leaving directory '/tmp/buildd/freewnn-1.1.1~a023/Wnn/uum'
../makerule.mk:282: recipe for target 'all' failed
make[2]: *** [all] Error 1
make[2]: Leaving directory '/tmp/buildd/freewnn-1.1.1~a023/Wnn'
makerule.mk:282: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/tmp/buildd/freewnn-1.1.1~a023'
dh_auto_build: make -j1 returned exit code 2
debian/rules:13: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package
W: no hooks of type C found -- ignoring
I: unmounting dev/pts filesystem
W: Could not unmount dev/pts: umount: /var/cache/pbuilder/build/cow.25983/dev/p\
ts: not mounted
W: Ignored error in unmount
I: unmounting run/shm filesystem
I: unmounting proc filesystem
 -> Cleaning COW directory
 forking: rm -rf /var/cache/pbuilder/build//cow.25983
gbp:error: 'git-pbuilder -uc -us' failed: it exited with 1


print_msg_getc() も printf() と同じく format を argument に取る
function です。
source では 4 つの arguments を取る function として
定義されています。

In Xwnmo/xwnmo/printf.c:
void
print_msg_getc (format, arg1, arg2, arg3)
     register char *format;
     char *arg1, *arg2, *arg3;
{
  int ret;

  sprintf (buf, format, arg1, arg2, arg3);
/* ... */

しかし、実際には可変数個の引数を取る function として
使われています。
そこで、今回の修正で vsnprintf(3) を使って
void
print_msg_getc (format, ...)
という風に書き直そうかと思います。
その上で print_msg_getc(STRING) と 1 argument のところは、
print_msg_getc("%s", STRING) と変えようと思います。

ついでに今回修正する function だけでも K&R -> ANSI に style
を変えようと思います。

これらの変更がまずいという方はいらっしゃいますか?


他にも同様の errors を指摘されそうな雰囲気ですので、
修正作業が終わるのにはもう少し時間がかかりそうです。

-- 
Mitsutoshi NAKANO <[email protected]> <[email protected]>
 <https://twitter.com/ItSANgo> <http://d.hatena.ne.jp/Itisango/>
 <https://launchpad.net/~bkbin005>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.