Package: debian-policy
Version: 4.6.2.0
X-Debbugs-Cc: debian-d...@lists.debian.org, de...@lists.debian.org

Hi,

first of all huge thanks to David, Guillem and Julian for all of their
explanations. In large parts, this bug report is yours and I'm just the
one writing it down.

§7.4 currently starts with:

    When one binary package declares a conflict with another using a
    Conflicts field, dpkg will refuse to allow them to be unpacked on
    the system at the same time.

I believe this is technically wrong. There are situations where dpkg
will allow such unpacks to temporarily co-exist. §6.6 goes into further
detail and is accurate.

Suppose we have two arch:all packages a version 1 and b version 1 both
of which are installed. Now we attempt to install a version 2, which
happens to declare "Conflicts: b (<< 2)". We may therefore mark b for
removal

    echo "b:all deinstall" | dpkg --set-selections

and proceed to installing a:

    dpkg --auto-deconfigure --unpack a_2.deb

When we do this, dpkg will unpack a version 2 before removing the files
of b version 1. I argue this is very briefly allowing these packages to
be unpacked at the same time as the next thing dpkg does is removing b's
files.

This situation can be forced if we add package b version 2, which
declares "Breaks: a (<< 2)" and attempt to install both. apt figures
that it has to temporarily remove b and hence issues the selection
above. Then it proceeds to unpacking both packages.

The difference actually is rather subtle. As dpkg is tracking ownership
of files, one should not be observing a difference. What one can see is
that a.preinst version 2 is run at a time where b version 1 is still
unpacked (and that's fine as the statement only talks about unpack). The
effects of concurrent unpack are theoretically not observable, due to
dpkg tracking files. However when you add aliasing to the mix, dpkg can
now delete files that are still needed via differences in aliasing. That
way - and I am fully aware that this violates fundamental assumptions of
dpkg - we can make the order of unpacks visible and demonstrate that
indeed a version 2 is unpacked before b version 1 has its files removed.
All of this is fully in line with the long description in §6.6. What I
take issue with is the executive summary at the start of §7.4.

In case you like some kind of test case to tinker with, I'm attaching a
script that demonstrates the situation.

Helmut

Attachment: conflict-demo.sh
Description: Bourne shell script

Reply via email to