vim RC bug #133314: question on postinst file
I'm looking at the postinst file for vim_6.0.201 (unstable), trying to
get a fix for the above-mentioned bug, and I need some higher wisdom here...
I've been staring at this code for hours, and can't for the life of me
figure out how the grep line does anything useful:
#! /bin/sh
set -e
pkg=vim
update_alt() {
buffer=`tempfile`
for i in vi view ex editor ; do
update-alternatives --display $i > $buffer
if ! grep -q '^\(vim\|/usr/man\)' $buffer; then
update-alternatives --install /usr/bin/$i $i /usr/bin/vim 120 \
--slave /usr/share/man/man1/$i.1.gz $i.1.gz \
/usr/share/man/man1/vim.1.gz
fi
done
rm -f $buffer
}
On my system, at least, that grep never matches on _anything_, and I
can't see how it would, for any alternative package other than vim
itself. The end result is that update-alternatives --install runs
for all the choices (vi, view, ex, editor), which seems to me to be
the correct behavior anyways.
Can anyone help me out here? Wichert Akkerman?
Anyways, if anyone's still reading this, here's how I think it should be
fixed:
update_alt() {
buffer=`tempfile`
for i in vi view ex editor ; do
- update-alternatives --display $i > $buffer
- if ! grep -q '^\(vim\|/usr/man\)' $buffer; then
update-alternatives --install /usr/bin/$i $i /usr/bin/vim 120 \
--slave /usr/share/man/man1/$i.1.gz $i.1.gz \
/usr/share/man/man1/vim.1.gz
fi
done
rm -f $buffer
}
--
Jon Franklin jfranklin@getnet.net
"Ua mau, ke ea o ka'aina i kapono"
The life of the land is preserved by righteousness.
-- Hawai'i state motto
Reply to: