突然ですが、本日、私は、
を冒していたことに気付いちゃいました。それに気付いたとき、私は一瞬、 顔面蒼白状態。
事の起こりは、最近 NetNews の fj.sources に流れた mh-6.8.3+-jp2c+-1.03 に気付いて、ひさびさに MH をインス トールしてみよう、と思ったことなんです。
実際の MH のインストールに関しては イ ンストール奮闘記 に譲りますが、その際、どうしても vmh.c が コンパイルできないんです。カーネルが 1.2.13 のときにはできてい たんで、意地になって調べてみると、どうやら私の環境には ncurses-4.1 がインストールされている。しかも半年程前に。(その ときのログは インストール奮闘記 にあります)
どうやらその為に MH のコンパイルができないらしい。それでも一 時、無理矢理 MH のソース (vmh.c) を編集してコンパイルは 通したのですが、ふと我に返って、「こんな苦労するなんて変だなぁ」と思っ て、いろいろ調べてみました。
私の ncurses-4.1 のインストールの仕方が悪いっていうことに気 付いたんです。
私の環境は元々は Slackware 3.0 です。これは ncurses のインクルードファイルは /usr/include/ncurses/ にあります。
/usr/include/ncurses: total 87 drwxr-xr-x 2 root root 1024 Jul 27 1996 . drwxr-xr-x 23 root root 3072 Sep 10 20:34 .. -rw-r--r-- 1 root root 32031 Aug 25 1995 curses.h -rw-r--r-- 1 root root 1946 Aug 25 1995 eti.h -rw-r--r-- 1 root root 9127 Aug 25 1995 menu.h lrwxrwxrwx 1 root root 8 Jul 27 1996 ncurses.h -> curses.h lrwxrwxrwx 1 root root 6 Jul 27 1996 nterm.h -> term.h -rw-r--r-- 1 root root 2648 Aug 25 1995 panel.h -rw-r--r-- 1 root root 31288 Aug 25 1995 term.h -rw-r--r-- 1 root root 1998 Aug 25 1995 termcap.h -rw-r--r-- 1 root root 1997 Aug 25 1995 unctrl.h
しかし、半年前の私はこの事に気付いていなかったので、 /usr/include/ に ncurses-4.1 のインクルードファイルをイ ンストールしちゃったんです。
/usr/include: total 805 ... -rw-r--r-- 1 root root 15525 May 25 19:32 form.h -rw-r--r-- 1 root root 2184 May 25 19:32 eti.h -rw-r--r-- 1 root root 10278 May 25 19:32 menu.h -rw-r--r-- 1 root root 2634 May 25 19:32 panel.h -rw-r--r-- 1 root root 2082 May 25 19:32 termcap.h -rw-r--r-- 1 root root 2177 May 25 19:32 unctrl.h -rw-r--r-- 1 root root 57084 May 25 19:32 curses.h -rw-r--r-- 1 root root 33928 May 25 19:32 term.h ...
つまり、つまりですね。本来 /usr/include/ にあるべきはずの termcap.h と curses.h に上書きして ncurses-4.1 の インクルードファイルをインストールしちゃったんですぅ。
やっばいよなぁ。どうにかして復旧せんと。
本日は termcap.h と curses.h の復活をさせぇぇぇる!
まずは今インストールされている ncurses-4.1 のインクルードファ イルには、ちょっとどいてもらおう。今現在の /usr/include/ncurses/ に入っているのは中のファイルを見ると 1.9.4 のものなので /usr/include/ncurses は /usr/include/ncurses-1.9.4 になってもらい、新たに /usr/include/ncurses-4.1 というディレクトリを作り、そこに移動し てもらう。
cipher 506# su Password: cipher:~# cd /usr/include/ cipher:~# mv ncurses ncurses-1.9.4 cipher:~# mkdir ncurses-4.1 cipher:~# mv form.h eti.h menu.h panel.h termcap.h unctrl.h curses.h term.h ncurses-4.1/ cipher:~# cd ncurses-4.1/ cipher:~# ls -l total 132 -rw-r--r-- 1 root root 57084 May 25 19:32 curses.h -rw-r--r-- 1 root root 2184 May 25 19:32 eti.h -rw-r--r-- 1 root root 15525 May 25 19:32 form.h -rw-r--r-- 1 root root 10278 May 25 19:32 menu.h -rw-r--r-- 1 root root 2634 May 25 19:32 panel.h -rw-r--r-- 1 root root 33928 May 25 19:32 term.h -rw-r--r-- 1 root root 2082 May 25 19:32 termcap.h -rw-r--r-- 1 root root 2177 May 25 19:32 unctrl.h
一応 1.9.4 と同じになるようにしておく。
cipher:~# mv curses.h ncurses.h cipher:~# ln -s ncurses.h curses.h cipher:~# mv term.h nterm.h cipher:~# ln -s nterm.h term.h cipher:~# ls -l total 132 lrwxrwxrwx 1 root root 9 Oct 14 20:05 curses.h -> ncurses.h -rw-r--r-- 1 root root 2184 May 25 19:32 eti.h -rw-r--r-- 1 root root 15525 May 25 19:32 form.h -rw-r--r-- 1 root root 10278 May 25 19:32 menu.h -rw-r--r-- 1 root root 57084 May 25 19:32 ncurses.h -rw-r--r-- 1 root root 33928 May 25 19:32 nterm.h -rw-r--r-- 1 root root 2634 May 25 19:32 panel.h lrwxrwxrwx 1 root root 7 Oct 14 20:06 term.h -> nterm.h -rw-r--r-- 1 root root 2082 May 25 19:32 termcap.h -rw-r--r-- 1 root root 2177 May 25 19:32 unctrl.h
もちろん /usr/include/ncurses-4.1 を /usr/include/ncurses で参照できるようにしておく。
cipher:~# cd /usr/include/ cipher:~# ln -s ncurses-4.1 ncurses
これで邪魔モノはいなくなった。さて、次は termcap.h の復活だ。 これには termcap-2.0.8.tar.gz を使うことにした。まずは展開。
cipher:~# ls -l total 263 -r--r--r-- 1 root root 268187 Oct 14 20:16 termcap-2.0.8.tar.gz cipher:~# tar xfz termcap-2.0.8.tar.gz
そしてコンパイル。
cipher:~# cd termcap-2.0.8
cipher:~# make CFLAGS='-O2 -I.'
if [ ! -d pic ]; then mkdir pic; fi
gcc -O2 -I. -M termcap.c tparam.c version.c | \
sed -e 's,^[ ]*\(.*\.o\)[ ]*:,\1 pic/\1:,' > .depend
gcc -O2 -I. -c termcap.c
gcc -O2 -I. -fPIC -c termcap.c -o pic/termcap.o
gcc -O2 -I. -c tparam.c
gcc -O2 -I. -fPIC -c tparam.c -o pic/tparam.o
gcc -O2 -I. -c version.c
gcc -O2 -I. -fPIC -c version.c -o pic/version.o
ar ucvr libtermcap.a termcap.o tparam.o version.o
a - termcap.o
a - tparam.o
a - version.o
cd pic; \
gcc -shared -o ../libtermcap.so.2.0.8 -Wl,-soname,libtermcap.so.2 termcap.o tparam.o version.o
makeinfo termcap.texi --output=termcap.info
Making info file `termcap.info' from `termcap.texi'.
あとはインストールだけど、その前に /etc/termcap のバックアッ プを取って置く。
cipher:~# cp -a /etc/termcap /etc/termcap.971014
これでよし。では termcap のインストールじゃ。
cipher:~# make install
if [ / = "/" ]; then \
mkdir -p /usr/lib /usr/info /usr/include /etc /lib; \
fi
if [ / = "/" ]; then \
cp termcap.src /etc/termcap; \
chown bin.bin /etc/termcap; \
fi
if [ -f //lib/libtermcap.so.2.0.8 ]; then \
mkdir -p //lib/backup; \
mv //lib/libtermcap.so.2.0.8 \
//lib/backup/libtermcap.so.2.0.8.$$; \
fi
cp libtermcap.so.2.0.8 //lib
chown bin.bin //lib/libtermcap.so.2.0.8
if [ -x /sbin/ldconfig -o -x /etc/ldconfig ]; then \
ldconfig; \
fi
if [ / = "/" ]; then \
cp -f libtermcap.a /usr/lib; \
rm -f /lib/libtermcap.so; \
rm -f /usr/lib/libtermcap.so; \
ln -s /lib/libtermcap.so.2.0.8 /usr/lib/libtermcap.so; \
cp -f termcap.h /usr/include; \
cp termcap.info* /usr/info; \
chown bin.bin \
/usr/info/termcap.info* \
/usr/lib/libtermcap.a \
/usr/lib/libtermcap.so \
/usr/include/termcap.h; \
else \
cp -f libtermcap.a //lib; \
rm -f //lib/libtermcap.so; \
ln -s //lib/libtermcap.so.2.0.8 \
//lib/libtermcap.so; \
cp -f termcap.h //include; \
chown bin.bin \
//lib/libtermcap.a \
//lib/libtermcap.so \
//include/termcap.h; \
fi
これで、まずは termcap.h が復活した。
cipher:~# ls -l /usr/include/termcap.h -rw-r--r-- 1 bin bin 1588 Oct 14 20:21 /usr/include/termcap.h
と思ったけど。どうもこの /etc/termcap を使うと kterm 上でも編集がおかしくなる。ので結局
cipher:~# cp -a /etc/termcap /etc/termcap-2.0.8.orig cipher:~# cp /etc/termcap.971014 /etc/termcap
とすることにしちゃう。:-)
さて、御次は curses.h だい。これは Slackware 3.3 の source/d/libc を覗いてみると curses-1.0.0.tar.gz という のがある。で、今の私の環境は、というと
cipher:~# ls -l /lib/libcurses* /usr/lib/libcurses* lrwxrwxrwx 1 root root 18 Jul 27 1996 /lib/libcurses.so.0 -> libcurses.so.0.1.2 -rwxr-xr-x 1 bin bin 49152 Dec 14 1994 /lib/libcurses.so.0.1.2 lrwxrwxrwx 1 root root 18 Jul 27 1996 /lib/libcurses.so.1 -> libcurses.so.1.0.0 -rwxr-xr-x 1 root root 52641 May 19 1995 /lib/libcurses.so.1.0.0 -rw-r--r-- 1 root root 84142 May 19 1995 /usr/lib/libcurses.a
である。
おぉ、バージョンは同じだね。これならばコンパイルしなくても良いかも しれない。んでは早速 Slackware 3.3 の d8 から libc.tgz を貰ってきましょ。
cipher:~# ls -l total 1014 -rw-r--r-- 1 root root 1032725 Oct 14 20:39 libc.tgz
とりあえず展開して中を確かめる。
cipher:~# tar xfz libc.tgz cipher:~# ls -l lib/incoming/libcurses.so.1.0.0 usr/lib/libcurses.a -rwxr-xr-x 1 root root 52641 May 19 1995 lib/incoming/libcurses.so.1.0.0 -rw-r--r-- 1 root root 84142 May 19 1995 usr/lib/libcurses.a
おおぉ、日付けもサイズも私の環境のと同じじゃん。よしよし。では MD5 も確認しとこっと。
cipher:~# md5sum lib/incoming/libcurses.so.1.0.0 usr/lib/libcurses.a 1c68d17e1de3b42877e40c7a610bfacb lib/incoming/libcurses.so.1.0.0 376d9e63a5083d26c5c420c84d00fdfa usr/lib/libcurses.a cipher:~# md5sum /lib/libcurses.so.1.0.0 /usr/lib/libcurses.a 1c68d17e1de3b42877e40c7a610bfacb /lib/libcurses.so.1.0.0 376d9e63a5083d26c5c420c84d00fdfa /usr/lib/libcurses.a
おっし。全く同じですな。じゃコレに入っている curses.h を貰え ばそれで済むじゃん。ラッキー!
cipher:~# cp -i usr/include/curses.h /usr/include/ cipher:~# chown bin.bin /usr/include/curses.h cipher:~# ls -l /usr/include/curses.h -rw-r--r-- 1 bin bin 12810 Oct 14 20:49 /usr/include/curses.h
これでよしっと。復活完了。
いやぁ、なんとか復活しました。よかった、よかった。一時はホントどう しようかと思っちゃいましたよ。でも復活できてホント良かったぁ。
今日はルンルンのスィッチオフ