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

Re: advice sought for fluxbox (release-critical, possible dpkg bug)



On Mon, May 23, 2005 at 11:51:29AM +0200, martin f krafft wrote:
> 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:

Meh.  This definitely looks like a dpkg bug, and it also explains how bug
#309485 got to be the way it was.  Well, at least we have an explanation
now.

>   root@woody:/# dpkg -l fluxbox | grep ^ii
>   ii  fluxbox        0.1.7-3        Highly configurable and low resource X11 Win
>   root@woody:/# md5sum /usr/bin/bsetbg*
>   2ea340efa4ee7d20cb76c2d48adf3fbf  /usr/bin/bsetbg
>   9ab1aca855e8990ca6df9399c24f20da  /usr/bin/bsetbg.blackbox
>   root@woody:/# 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

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

>   root@woody:/# 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.

That part is a fluxbox bug, and not even a bug in the previous version but
in the current one; you can't remove a diversion for a file until you've
removed your version of the file, otherwise you get a file collision.

> 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:

>   root@woody:/# 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) ...
>   [...]
>   root@woody:/# 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.

>   root@woody:/# dpkg -S /usr/bin/bsetbg                                           diversion by fluxbox from: /usr/bin/bsetbg
>   diversion by fluxbox to: /usr/bin/bsetbg.blackbox
>   blackbox: /usr/bin/bsetbg
>   root@woody:/# 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.

For further fun (and to see the exact bug that libldap2 was tripping
across), remove blackbox and then un-divert (by hand, in this case) bsetbg.
You get a nice little file named /usr/bin/bsetbg, which dpkg knows nothing
about.

:/


> 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?

I think checking the output of dpkg-divert --list is probably redundant
here, FWIW.

-- 
Steve Langasek
postmodern programmer

Attachment: signature.asc
Description: Digital signature


Reply to: