[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problem with update-alternatives?



I'm presuming that this is just a misuse of update-alternatives in the
current emacs20 pacakge, but I wanted to make sure.

In the current emacs20 package postinst I do this to install the
binary symlink:

  update-alternatives --install /usr/bin/emacs emacs /usr/bin/emacs-20.2 23 \
    --slave /usr/man/man1/emacs.1.gz emacs.1.gz \
            /usr/man/man1/emacs.1emacs20.gz

Then in the prerm (left over from ages past, and similar to many other
packages) the emacs20 package does this:

  if [ "$1" != "upgrade" ]
  then
    update-alternatives --remove emacs /usr/bin/emacs-20.2
  fi

Following this pattern, the upcoming emacs-20.3 did the same thing,
but replaces the emacs-20.2 with emacs-20.3 in the code fragments
above.  This causes a problem because update-alternatives leaves the
old link pointing to emacs-20.2 even though the upgrade has removed
that binary, and wants the new link to point to emacs-20.3.

Am I correct in assuming that this is a misuse of update-alternatives
because you can't ever change the name of the binary alternative in a
given package and expect upgrades to work.  If so, then I presume that
the emacs20 package should have used /usr/bin/emacs20 in both
packages, rather than /usr/bin/emacs-20.X:

  update-alternatives --install /usr/bin/emacs emacs /usr/bin/emacs20 ...

It might be nice if update-alternatives would notice dangling symlinks
and accept any alternative that fixes that problem.

As it stands now, I guess I'll have to add another "fix" to the
emacs20 postinst to repair this problem.

Thanks

-- 
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930


Reply to: