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

Re: Bug#504880: Disambiguate "installed" for packages



Jonathan Nieder <jrnieder@gmail.com> writes:
> Russ Allbery wrote:
>> Jonathan Nieder <jrnieder@gmail.com> writes:

>>>  * postrm does not get called until pre-dependencies for the new
>>>    version are satisfied.  So I think it is impossible for
>>>    pre-dependencies to be half-installed here.

>> I believe, from what Ian said, that it's possible if the
>> pre-dependencies of the old version are different than the
>> pre-dependencies of the new version and the upgrade of the
>> pre-dependencies failed.

> The following is only about "postrm upgrade" and "preinst abort-upgrade".

> I don’t follow; could you explain further?  The order of operations
> during an upgrade when all goes well is something like this:

> 	<check pre-dependencies>
> 	preinst upgrade
> 	<unpack>
> 	postrm upgrade
> 	... unpack other things ...
> 	<satisfy dependencies>
> 	postinst upgrade

> In particular, if postrm fails, then pre-dependencies will have already
> been checked...

Suppose that you have a package foo 1.0-1 with:

    Pre-Depends: bar

and a package foo 2.0-1 that has no pre-dependencies.  foo and bar are
both currently installed.  Now, you:

    dpkg -i bar_2.0-1.deb
    ^C

(or something else bad happens in the middle).  bar is now half-installed.
Nothing has happened to foo because attempted upgrades of dependencies and
pre-dependencies do not require deconfiguring packages.

Now you run:

    dpkg -i foo_2.0-1.deb

foo 2.0-1 has no pre-dependencies, so the pre-dependency check succeeds.
Installation proceeds and foo 2.0-1 is unpacked, and then the foo 1.0-1
postrm upgrade fails.  Error unwind happens and the foo 1.0-1 preinst is
called with abort-upgrade.  bar is only half-installed.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: