Bug#777760: apt: fails to satisfy dependencies of the form package:arch with arch being the native architecture

2015-04-12 Thread David Kalnischkies
Hi,

On Thu, Feb 12, 2015 at 11:25:33AM +0100, Johannes Schauer wrote:
 apt in unstable/jessie fails to satisfy binary dependencies of the form
 package:arch if arch happens to be the native architecture.

As briefly discussed on IRC, this happens also for /experimental, but it
happens only on single-architecture systems, multi-arch enabled systems
aren't effected.

The problem is a single-arch special casing generating incorrect
dependencies, which for foreign dependencies still means they are
unsatisfiable, but native ones are, too. This is especially true for
negative arch-specific dependencies, which do not match a native
conflict partner and hence trick apt into ignoring these conflicts.

Neither is really a problem for jessie as such dependencies do not exist
there. Even sid has only one such package: botch - maintained by the
bugreporter himself.

In terms of upgrade ability to stretch later on it might be beneficial
to apply this to jessie – after all, we can't botch the upgrade for all
botch users… ;)


The patch is 'trivial' one-line - the also included update to the
testcases to look for this and similar issues blows it out of proportion
through, but that can be skipped as it isn't run at buildtime.


Best regards

David Kalnischkies
commit 596ec43ce34421080a58b28299c1ed9cb0dbaa25
Author: David Kalnischkies da...@kalnischkies.de
Date:   Sun Apr 12 19:16:01 2015 +0200

parse specific-arch dependencies correctly on single-arch systems

On single-arch the parsing was creating groupnames like 'apt:amd64' even
through it should be 'apt' and a package in it belonging to architecture
amd64. The result for foreign architectures was as expected: The
dependency isn't satisfiable, but for native architecture it means the
wrong package (ala apt:amd64:amd64) is linked so this is also not
satisfiable, which is very much not expected.

No longer excluding single-arch from this codepath allows the generation
of the correct links, which still link to non-exisiting packages for
foreign dependencies, but natives link to the expected native package
just as if no architecture was given.

For negative arch-specific dependencies ala Conflicts this matter was
worse as apt will believe there isn't a Conflict to resolve, tricking it
into calculating a solution dpkg will refuse.

Architecture specific positive dependencies are rare in jessie – the
only one in amd64 main is foreign –, negative dependencies do not even
exist. Neither class has a native specimen, so no package in jessie is
effected by this bug, but it might be interesting for stretch upgrades.
This also means the regression potential is very low.

Closes: 60

diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 4eef66c..213235c 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -770,7 +770,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver,
 	 if (NewDepends(Ver,Package,none,Version,Op,Type) == false)
 	return false;
   }
-  else if (MultiArchEnabled == true  found != string::npos 
+  else if (found != string::npos 
 	   strcmp(Package.c_str() + found, :any) != 0)
   {
 	 string Arch = Package.substr(found+1, string::npos);
diff --git a/test/integration/test-multiarch-foreign b/test/integration/test-multiarch-foreign
index 332466d..240f1a4 100755
--- a/test/integration/test-multiarch-foreign
+++ b/test/integration/test-multiarch-foreign
@@ -7,9 +7,13 @@ setupenvironment
 configarchitecture 'amd64' 'i386' 'armel'
 
 insertpackage 'unstable' 'cool-foo' 'amd64,i386' '1.0' 'Depends: foo'
+insertpackage 'unstable' 'cool-foo-x64' 'amd64' '1.0' 'Depends: foo:amd64'
+insertpackage 'unstable' 'cool-foo-x32' 'amd64' '1.0' 'Depends: foo:i386'
 insertpackage 'unstable' 'foo' 'amd64,i386,armel' '1.0' 'Multi-Arch: foreign'
 
 insertpackage 'unstable' 'cool-bar' 'amd64,i386' '1.0' 'Depends: bar-provider'
+insertpackage 'unstable' 'cool-bar-x64' 'amd64' '1.0' 'Depends: bar-provider:amd64'
+insertpackage 'unstable' 'cool-bar-x32' 'amd64' '1.0' 'Depends: bar-provider:i386'
 insertpackage 'unstable' 'bar' 'amd64,i386,armel' '1.0' 'Provides: bar-provider
 Multi-Arch: foreign'
 
@@ -29,28 +33,6 @@ Conf cool-foo:i386 (1.0 unstable [i386])' aptget install cool-foo:i386 -s
 
 testequal 'Reading package lists...
 Building dependency tree...
-The following extra packages will be installed:
-  foo
-The following NEW packages will be installed:
-  cool-foo foo
-0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
-Inst foo (1.0 unstable [amd64])
-Inst cool-foo (1.0 unstable [amd64])
-Conf foo (1.0 unstable [amd64])
-Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 -s
-
-testequal 'Reading package lists...
-Building dependency tree...
-The following NEW packages will be installed:
-  cool-foo foo
-0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
-Inst 

Bug#777760: apt: fails to satisfy dependencies of the form package:arch with arch being the native architecture

2015-02-12 Thread Johannes Schauer
Package: apt
Version: 1.0.9.6
Severity: normal

Hi,

apt in unstable/jessie fails to satisfy binary dependencies of the form
package:arch if arch happens to be the native architecture.

steps to reproduce:

$ sudo debootstrap --variant=minbase sid debian-sid 
http://127.0.0.1:3142/http.debian.net/debian
$ sudo mkdir debian-sid/repository
$ cat  END | sudo tee debian-sid/repository/Packages  /dev/null
Package: foo
Version: 1.0
Architecture: amd64
Depends: blub:amd64

Package: blub
Version: 1.0
Architecture: amd64
END
$ echo deb file:/repository ./ | sudo tee -a 
debian-sid/etc/apt/sources.list  /dev/null
$ sudo chroot debian-sid apt-get update
$ sudo chroot debian-sid apt-get install -o 
Debug::pkgProblemResolver=true -o Debug::pkgDepCache::Marker=1 -o 
Debug::pkgDepCache::AutoInstall=1 foo
Reading package lists... Done
Building dependency tree... Done
  foo:amd64 Depends on blub:amd64 [ amd64 ]  none  ( none ) can't be 
satisfied!
Starting pkgProblemResolver with broken count: 1
Starting 2 pkgProblemResolver with broken count: 1
Investigating (0) foo [ amd64 ]  none - 1.0  ( unknown )
Broken foo:amd64 Depends on blub:amd64 [ amd64 ]  none  ( none )
Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 foo : Depends: blub:amd64 but it is not installable
E: Unable to correct problems, you have held broken packages.

On the other hand it works with foreign architectures (at least as far
as the resolver seems to be concerned - it only fails on the missing
Filename: field):

$ sudo chroot debian-sid dpkg --add-architecture i386
$ cat  END | sudo tee debian-sid/repository/Packages  /dev/null
Package: foo
Version: 1.0
Architecture: amd64
Depends: blub:i386

Package: blub
Version: 1.0
Architecture: i386
END
$ sudo chroot debian-sid apt-get update
$ sudo chroot debian-sid apt-get install -o 
Debug::pkgProblemResolver=true -o Debug::pkgDepCache::Marker=1 -o 
Debug::pkgDepCache::AutoInstall=1 foo
Reading package lists... Done
Building dependency tree... Done
  MarkInstall foo [ amd64 ]  none - 1.0  ( unknown ) FU=1
  Installing blub as Depends of foo
MarkInstall blub [ i386 ]  none - 1.0  ( unknown ) FU=0
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following extra packages will be installed:
  blub:i386
The following NEW packages will be installed:
  blub:i386 foo
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
E: The package index files are corrupted. No Filename: field for 
package blub.

Lets try experimental apt:

$ echo deb http://127.0.0.1:3142/http.debian.net/debian experimental 
main | sudo tee -a debian-sid/etc/apt/sources.list  /dev/null
$ sudo chroot debian-sid apt-get update
$ sudo chroot debian-sid apt-get install -t experimental apt
$ cat  END | sudo tee debian-sid/repository/Packages  /dev/null
Package: foo
Version: 1.0
Architecture: amd64
Depends: blub:amd64

Package: blub
Version: 1.0
Architecture: amd64
END
$ sudo chroot debian-sid apt-get update
$ sudo chroot debian-sid apt-get install -o 
Debug::pkgProblemResolver=true -o Debug::pkgDepCache::Marker=1 -o 
Debug::pkgDepCache::AutoInstall=1 foo
Reading package lists... Done
Building dependency tree   
Reading state information... Done
  MarkInstall foo [ amd64 ]  none - 1.0  ( unknown ) FU=1
  Installing blub as Depends of foo
MarkInstall blub [ amd64 ]  none - 1.0  ( unknown ) FU=0
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following extra packages will be installed:
  blub
The following NEW packages will be installed:
  blub foo
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
E: The package index files are corrupted. No Filename: field for 
package blub.

So gladly this is only a problem with apt unstable/jessie but not in
experimental.

cheers, josch


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact