Your message dated Wed, 18 Feb 2009 21:22:26 +0100
with message-id <20090218202226.ga24...@rivendell>
and subject line Re: Bug#137315: dpkg: update-alternatives: creation of `link' 
doesn't respect `Replaces:'.
has caused the Debian Bug report #137315,
regarding [U-A] dpkg: update-alternatives: creation of `link' doesn't respect 
`Replaces:'.
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
137315: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=137315
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
On Fri, 08 Mar 2002, Peter Moulder wrote:
> /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.

update-alternatives can be used by packages and by admins, there's no
associated package to each alternative and as such we can't really
check the Replaces: relation.

The documentation of update-alternatives clearly says that you can't
replace an existing file with an alternative without cooperation of all
involved packages.

This must be handled by ensuring that the file is removed first (with
Conflicts: for instance).

Thus I'm closing this non-bug.

Cheers,
-- 
Raphaël Hertzog

Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/


--- End Message ---

Reply via email to