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

Bug#605394: pulls in uneeded/unwanted php package, breaking apache



(discussed on IRC, but for record-keeping proposes)

On Mon, Nov 29, 2010 at 16:33, Peter Palfrader <weasel@debian.org> wrote:
> quantz.d.o is on squeeze, and php was updated in testing.  Now apt wants
> to pull in libapache2-mod-php5 and mess up our apache while it's at it:

The problem is that at the time APT looks at php5 the dependency:
libapache2-mod-php5 (>= 5.3.3-4) | libapache2-mod-php5filter (>=
5.3.3-4) | php5-cgi (>= 5.3.3-4)
isn't satisfied as php5-cgi is installed, but only at version 5.3.3-3, so APT
sees the or-group as not satisfied and tries to statisfy it by installing
libapache2-mod-php5. This leads to the installation of another apache2-mpm
provider, apache2-mpm-prefork in this case which wants to remove
apache2-mpm-worker.

Which package APT favors later in the resolver depends on the exact system
configuration, so you can be lucky and APT chooses the "right" solution or
doing what happened on quantz…

Anyway: The proper solution would be to look in an or-group first to check
if an installed package can be upgraded to solve the dependency and then
in a second run the current behavior. This will properly generate a lot of
code (e.g. if you want to do it right, you want to look at Provides, too,
enhancing complexity even further) and is maybe even a hit performance wise.

For dist-upgrade its easier to mark all installed packages first for
installation and then walk again over all to really install them.
This way the resolver would see the dependency from above as satisfied as
php5-cgi (>= 5.3.3-4) is already marked for installation…

But this solution doesn't help in "apt-get install php5" situation,
here is it still "apt-get install php5 php5-cgi" to get the right solution
if the system is in the same state as in the dist-upgrade…
(Nobody said partial upgrades would be easy…)


Best regards

David Kalnischkies
=== modified file 'apt-pkg/algorithms.cc'
--- apt-pkg/algorithms.cc	2010-11-10 11:24:48 +0000
+++ apt-pkg/algorithms.cc	2010-11-29 20:43:07 +0000
@@ -374,6 +374,13 @@
 {
    pkgDepCache::ActionGroup group(Cache);
 
+   /* Upgrade all installed packages first without autoinst to help the resolver
+      in versioned or-groups to upgrade the old solver instead of installing
+      a new one (if the old solver is not the first one [anymore]) */
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
+      if (I->CurrentVer != 0)
+	 Cache.MarkInstall(I, false, 0, false);
+
    /* Auto upgrade all installed packages, this provides the basis 
       for the installation */
    for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)

=== modified file 'debian/changelog'
--- debian/changelog	2010-11-27 15:18:27 +0000
+++ debian/changelog	2010-11-29 20:43:07 +0000
@@ -6,7 +6,13 @@
       will actually test uncompressed indexes regardless of the internal
       default value of Acquire::GzipIndexes.
 
- -- Michael Vogt <mvo@debian.org>  Thu, 25 Nov 2010 16:08:01 +0100
+  [ David Kalnischkies ]
+  * apt-pkg/algorithms.cc:
+    - mark all installed packages first without auto installation in
+      a dist-upgrade to prefer upgrading packages instead of installing
+      new packages in versioned or-groups (Closes: #605394)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 29 Nov 2010 21:41:56 +0100
 
 apt (0.8.9) unstable; urgency=low
 

=== added file 'test/integration/Packages-bug-605394-versioned-or-groups'
--- test/integration/Packages-bug-605394-versioned-or-groups	1970-01-01 00:00:00 +0000
+++ test/integration/Packages-bug-605394-versioned-or-groups	2010-11-29 20:43:07 +0000
@@ -0,0 +1,71 @@
+Package: apache2-mpm-prefork
+Priority: optional
+Section: httpd
+Installed-Size: 68
+Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.org>
+Architecture: i386
+Source: apache2
+Version: 2.2.16-4
+Provides: apache2-mpm
+Conflicts: apache2-mpm
+Filename: pool/main/a/apache2/apache2-mpm-prefork_2.2.16-4_i386.deb
+Size: 2276
+MD5Sum: c0db3e637052e59dbdb2fa08f4cdcea4
+Description: Apache HTTP Server - traditional non-threaded model
+Task: web-server
+
+Package: apache2-mpm-worker
+Priority: optional
+Section: httpd
+Installed-Size: 68
+Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.org>
+Architecture: i386
+Source: apache2
+Version: 2.2.16-4
+Provides: apache2-mpm
+Conflicts: apache2-mpm
+Filename: pool/main/a/apache2/apache2-mpm-worker_2.2.16-4_i386.deb
+Size: 2220
+MD5Sum: 71bccda875aa0afac700410b951370ba
+Description: Apache HTTP Server - high speed threaded model
+
+Package: libapache2-mod-php5
+Priority: optional
+Section: httpd
+Installed-Size: 7588
+Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
+Architecture: i386
+Source: php5
+Version: 5.3.3-4
+Depends: apache2-mpm-prefork (>> 2.0.52)
+Filename: pool/main/p/php5/libapache2-mod-php5_5.3.3-4_i386.deb
+Size: 2886980
+MD5Sum: b41ec4b98aa08966288570e07cd864ab
+Description: server-side, HTML-embedded scripting language (Apache 2 module)
+Task: web-server
+
+Package: php5-cgi
+Priority: optional
+Section: php
+Installed-Size: 14672
+Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
+Architecture: i386
+Source: php5
+Version: 5.3.3-4
+Filename: pool/main/p/php5/php5-cgi_5.3.3-4_i386.deb
+Size: 5713726
+MD5Sum: 9e579982032c7bb98508e16e314f45e9
+Description: server-side, HTML-embedded scripting language (CGI binary)
+
+Package: php5
+Priority: optional
+Section: php
+Installed-Size: 20
+Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
+Architecture: all
+Version: 5.3.3-4
+Depends: libapache2-mod-php5 (>= 5.3.3-4) | php5-cgi (>= 5.3.3-4)
+Filename: pool/main/p/php5/php5_5.3.3-4_all.deb
+Size: 1050
+MD5Sum: cbedd95ed5b868ba1ffd10747abc0ee3
+Description: server-side, HTML-embedded scripting language (metapackage)

=== added file 'test/integration/status-bug-605394-versioned-or-groups'
--- test/integration/status-bug-605394-versioned-or-groups	1970-01-01 00:00:00 +0000
+++ test/integration/status-bug-605394-versioned-or-groups	2010-11-29 20:43:07 +0000
@@ -0,0 +1,34 @@
+Package: apache2-mpm-worker
+Status: install ok installed
+Priority: optional
+Section: httpd
+Installed-Size: 68
+Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.org>
+Architecture: i386
+Source: apache2
+Version: 2.2.16-4
+Provides: apache2-mpm
+Conflicts: apache2-mpm
+Description: Apache HTTP Server - high speed threaded model
+
+Package: php5-cgi
+Status: install ok installed
+Priority: optional
+Section: php
+Installed-Size: 14672
+Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
+Architecture: i386
+Source: php5
+Version: 5.3.3-3
+Description: server-side, HTML-embedded scripting language (CGI binary)
+
+Package: php5
+Status: install ok installed
+Priority: optional
+Section: php
+Installed-Size: 20
+Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
+Architecture: all
+Version: 5.3.3-3
+Depends: libapache2-mod-php5 (>= 5.3.3-3) | libapache2-mod-php5filter (>= 5.3.3-3) | php5-cgi (>= 5.3.3-3)
+Description: server-side, HTML-embedded scripting language (metapackage)

=== added file 'test/integration/test-bug-605394-versioned-or-groups'
--- test/integration/test-bug-605394-versioned-or-groups	1970-01-01 00:00:00 +0000
+++ test/integration/test-bug-605394-versioned-or-groups	2010-11-29 20:43:07 +0000
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -e
+
+local TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture "i386"
+setupaptarchive
+
+testequal "Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+  php5 php5-cgi
+2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Need to get 0 B/5715 kB of archives.
+After this operation, 0 B of additional disk space will be used.
+E: Trivial Only specified but this is not a trivial operation." aptget dist-upgrade --trivial-only
+
+msgtest "Solution process doesn't involve" 'apache2-mpm-prefork'
+
+if aptget dist-upgrade --trivial-only -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 2>&1 | grep apache2-mpm-prefork > /dev/null; then
+	msgfail
+else
+	msgpass
+fi


Reply to: