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

Bug#137315: dpkg: update-alternatives: creation of `link' doesn't respect `Replaces:'.



Package: dpkg
Version: 1.9.19
Severity: minor

[Addressed to ftp maintainer as well as dpkg bug submission.]

Concrete example:

  Package: ftp
  Source: netkit-ftp
  Replaces: netstd

/usr/bin/ftp is a regular file in netstd, while in the `ftp' package it is to
be created with update-alternatives:
ftp.postinst:

  update-alternatives --install /usr/bin/ftp ftp /usr/bin/netkit-ftp 100 \
		      --slave /usr/share/man/man1/ftp.1.gz ftp.1.gz \
			      /usr/share/man/man1/netkit-ftp.1.gz

However, update-alternatives refuses to remove the existing regular
file to replace it with a symlink, even though the regular file in
question is provided by a package that the path's providing package
Replaces.

I believe that at least in the above case between ftp and netstd, the
desired outcome should be that the regular file be removed and
replaced with the symlink.

What's less clear is how this should be achieved: should the ftp
package special-case this in its postinst file, conditionally removing
/usr/bin/ftp before calling update-alternatives, or whether
update-alternatives should test whether a Replaces relationship exists
between the package providing the `path' argument (/usr/bin/netkit-ftp
in the above example) and the package providing the `link' argument
(/usr/bin/ftp).

I think that update-alternatives is the right place to address this,
but that may be only because I haven't thought long enough about
whether there are cases where the behaviour I've suggested would give
the wrong results (or whether what I've suggested is practical).

As an initial suggestion of implementation, let's say that the
ftp.postinst alternative could be:

  if [ netstd = "`dpkg -S /usr/bin/ftp 2>/dev/null | cut -d: -f1`" ]; then
    rm -f /usr/bin/ftp
  fi
  update-alternatives ... [existing arguments here]

while the update-alternatives alternative would be to insert some code in the
true case of the if test at line 412 (for dpkg version 1.9.19).  Not sure of
the right perl code, but a naive approach would be ...  Heck, I'm writing to
the dpkg maintainer, no point teaching grandmother to suck eggs.

In practice, this would fall somewhere near the bottom of the todo
list for update-alternatives, so I'd suggest that the ftp package
implement the workaround as an interim measure.

pjm.


-- System Information
Debian Release: testing/unstable
Kernel Version: Linux bowman 2.2.9 #5 SMP Mon May 17 14:42:42 EST 1999 i686 unknown

Versions of the packages dpkg depends on:
ii  libc6          2.2.4-7        GNU C Library: Shared libraries and Timezone
ii  libncurses5    5.2.20020112a- Shared libraries for terminal handling
ii  libstdc++2.10- 2.95.4-0.01100 The GNU stdc++ library

ftp package version: 0.17-9



Reply to: