Bug#411697: vim maintainer scripts switch on "$1" when they shouldn't

Ian Jackson iwj at ubuntu.com
Tue Feb 20 14:28:44 UTC 2007

Package: vim
Version: 7.0-164+2

Many of the vim maintainer scripts only do their processing if the
invocation context is the most normal one that the script author is
expecting.  For example, in the postinst of vim_7.0-164+3_i386.deb, we
see this:

 case "$1" in
     case "$pkg" in

This is wrong.

dpkg's invocations of these scripts are carefully planned so that the
right behaviour is generally for each script to do the same thing no
matter why it was called, so for most ordinary situations the right
thing for a maintainer script is to ignore $1.

I haven't examined in detail all of the maintainer scripts in the vim
packages, so I can't say with confidence that all of these tests of $1
are wrong, but all of the ones I have seen seem wrong to me.  The
scripts should be examined and the purpose of these tests considered,
so that the condition can be removed except where they are known to be

One example of a problem caused by these spurious tests is #399024, in
which some alternatives links were not removed under some
circumstances because the prerm is invoked for upgrade rather than

If I am currently addressing the person who wrote these scripts
originally then I would be interested to hear where the notion to
switch on $1 in this way came from, since it might be worth updating
the relevant documentation or example packages, or educating the
`expert' which was the original source.

Thanks for your attention.


More information about the pkg-vim-maintainers mailing list