The fluxbox in woody, 0.1.7-3 diverts /usr/bin/bsetbg to
/usr/bin/bsetbg.blackbox, but it only removes those diversions in
postrm/remove. Installing and deinstalling this package works fine,
with or without blackbox installed:

  [EMAIL PROTECTED]:/# dpkg -l fluxbox | grep ^ii
  ii  fluxbox        0.1.7-3        Highly configurable and low resource X11 Win
  [EMAIL PROTECTED]:/# md5sum /usr/bin/bsetbg*
  2ea340efa4ee7d20cb76c2d48adf3fbf  /usr/bin/bsetbg
  9ab1aca855e8990ca6df9399c24f20da  /usr/bin/bsetbg.blackbox
  [EMAIL PROTECTED]:/# dpkg -S /usr/bin/bsetbg   
  diversion by fluxbox from: /usr/bin/bsetbg
  diversion by fluxbox to: /usr/bin/bsetbg.blackbox
  blackbox, fluxbox: /usr/bin/bsetbg

  [EMAIL PROTECTED]:/# dpkg --remove fluxbox
  [...]
  Removing `diversion of /usr/bin/bsetbg to /usr/bin/bsetbg.blackbox by fluxbox'
  [...]
  [EMAIL PROTECTED]:/# md5sum /usr/bin/bsetbg*
  9ab1aca855e8990ca6df9399c24f20da  /usr/bin/bsetbg
  [EMAIL PROTECTED]:/# dpkg -S /usr/bin/bsetbg
  blackbox: /usr/bin/bsetbg

  [EMAIL PROTECTED]:/# dpkg -i /var/cache/apt/archives/fluxbox_0.1.7-3_i386.deb 
  [...]
  Unpacking fluxbox (from .../fluxbox_0.1.7-3_i386.deb) ...
  Adding `diversion of /usr/bin/bsetbg to /usr/bin/bsetbg.blackbox by fluxbox'
  [...]
  Setting up fluxbox (0.1.7-3) ...

A problem arises (#310050) when 0.9.11-* is used to upgrade the
woody version. 0.9.11-* does not provide /usr/bin/bsetbg anymore,
but 0.1.7-3 is not given a chance to remove it, since on an upgrade,
old-postrm/remove is (obvioulsy) not called.

Thus, when 0.9.11-* has been unpacked, dpkg does not know about
/usr/bin/bsetbg anymore, but it still has a diversion for it:

  [EMAIL PROTECTED]:/# dpkg --unpack 
/var/cache/apt/archives/fluxbox_0.9.11-1sarge0_i386.deb 
  [...]
  Preparing to replace fluxbox 0.1.7-3 (using 
.../fluxbox_0.9.11-1sarge0_i386.deb) ...
  [...]
  [EMAIL PROTECTED]:/# dpkg -S /usr/bin/bsetbg                                  
         diversion by fluxbox from: /usr/bin/bsetbg
  diversion by fluxbox to: /usr/bin/bsetbg.blackbox
  blackbox: /usr/bin/bsetbg

So far so good (well, or bad). This could be easily fixed in the
0.9.11 postinst. It would have to be postinst since the preinst is
called before the 0.1.7-3 files are removed, and no diversions for
still-existing files can be removed.

Now make sure to be seated: after the unpack, however,
/usr/bin/bsetbg is still on the system, but dpkg knows jack about
it.

  [EMAIL PROTECTED]:/# dpkg -S /usr/bin/bsetbg                                  
         diversion by fluxbox from: /usr/bin/bsetbg
  diversion by fluxbox to: /usr/bin/bsetbg.blackbox
  blackbox: /usr/bin/bsetbg
  [EMAIL PROTECTED]:/# md5sum /usr/bin/bsetbg*
  2ea340efa4ee7d20cb76c2d48adf3fbf  /usr/bin/bsetbg
  9ab1aca855e8990ca6df9399c24f20da  /usr/bin/bsetbg.blackbox

This is our main problem and a complete mystery. The rest of this
post is just a consequence. The same applies to the associated
manpage, btw. And it seems not to make a difference in which order
blackbox and fluxbox are upgraded -- as long as blackbox is
installed. If it is not, then this entire problem does not appear.

So now, we have 0.9.11-* installed and a stray diversion from
0.1.7-3 for a file which was left behind but erased from dpkg's
database.

But the diversion can't be removed. If dpkg-divert --remove is
called with --rename, it's good for the tool to fail. However,
without --rename, it should just remove the diversion as it has no
record of the diverted file name in its database. However, #160848
is unfixed, which means that dpkg-divert always renames on remove.
Anyway, as vorlon points out, it would not make sense to un/register
a diversion without performing the rename, really, so this is just
information on the side.

Hence we are faced with the task to rectify the situation. While we
are of course very interested in finding out just why dpkg is being
such a bad citizen in this case and forgets about a file without
deleting it, we are more interested in producing a robust fix to get
fluxbox into sarge proper.

Right now, the only way seems to be to call the following ugly hack
in postinst/upgrade:

  if [ -n "$2" ] && dpkg --compare-versions "$2" le "0.1.7-3"; then
    if [ -f /usr/bin/bsetbg ] && [ -f /usr/bin/bsetbg.blackbox ] \
      && dpkg-divert --list /usr/bin/bsetbg | \
          grep -q '^diversion.*by fluxbox$'; then
      rm /usr/bin/bsetbg
    fi
    if [ -f /usr/share/man/man1/bsetbg.1.gz ] \
      && [ -f /usr/share/man/man1/bsetbg.1.gz.blackbox ] \
      && dpkg-divert --list /usr/bin/bsetbg | \
          grep -q '^diversion.*by fluxbox$'; then
      rm /usr/share/man/man1/bsetbg.1.gz
    fi
    dpkg-divert --package fluxbox --remove --rename /usr/bin/bsetbg
    dpkg-divert --package fluxbox --remove --rename 
/usr/share/man/man1/bsetbg.1.gz
  fi

Do you know any better way?

-- 
Please do not send copies of list mail to me; I read the list!
 
 .''`.     martin f. krafft <[EMAIL PROTECTED]>
: :'  :    proud Debian developer, admin, user, and author
`. `'`
  `-  Debian - when you have better things to do than fixing a system
 
Invalid/expired PGP subkeys? Use subkeys.pgp.net as keyserver!
 
"verbing weirds language."
                                                           -- calvin

Attachment: signature.asc
Description: Digital signature

Reply via email to