Control: tags -1 - patch pending
Control: severity -1 wishlist

Am Fri, Mar 20, 2026 at 11:05:57AM +0100, schrieb Xavier:
> This little patch avoid checking the bad version.

Thanks for providing a patch and even a test, but…

As I wrote in my other mail yesterday before seeing this one today,
while uncommon, this is not unheard of and not a bug to fix in apt™.

APT is not at liberty to decide willy nilly how to interpret
dependencies in the general case.

Debian policy §7.5 specifying Provides clearly says:
| A Provides field may contain version numbers, and such a version
| number will be considered when considering a dependency on or conflict
| with the virtual package name.

"virtual package name" here could be read as your saving grace as
we are talking about a package name that is not only virtual, but
also concrete, but:
| If there are both concrete and virtual packages of the same name,
| then the dependency may be satisfied (or the conflict caused) by
| either the concrete package with the name in question or any other
| concrete package which provides the virtual package with the name
| in question.

So if your are serious about "fixing" this, you will have to fix
the policy first, which likely entails adding a self-provide exception
similar to the self-conflict one, but:
In that moment, you may provide a reason as to why you need to write
such a Provides in the first place, if you require it to be ignored
by all tools reading it.

It seems better to change whatever tool generates this to not do so
instead of teaching all tools to ignore it.


> However, the message given by apt in its log was totally wrong (se bellow).

I agree. Using your patch with a test case (attached) that actually
builds packages and passes them on to dpkg shows:

```
[…]
Reading package lists...
Building dependency tree...
Solving dependencies...
The following NEW packages will be installed:
  bar foo-big foo-small
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3696 B of archives.
After this operation, 33.8 kB of additional disk space will be used.
Get:1 file:/tmp/tmp.oMkacgqZBY/aptarchive unstable/main amd64 bar amd64 1 [1242 
B]
Get:2 file:/tmp/tmp.oMkacgqZBY/aptarchive unstable/main all foo-big all 1 [1226 
B]
Get:3 file:/tmp/tmp.oMkacgqZBY/aptarchive unstable/main all foo-small all 2 
[1228 B]
Selecting previously unselected package bar.
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack .../pool/bar_1_amd64.deb ...
Unpacking bar (1) ...
Selecting previously unselected package foo-big.
dpkg: regarding .../pool/foo-big_1_all.deb containing foo-big:
 bar conflicts with foo-big (>= 2)
  foo-big provides foo-big and is to be installed.

dpkg: error processing archive 
/tmp/tmp.oMkacgqZBY/aptarchive/pool/foo-big_1_all.deb (--unpack):
 conflicting packages - not installing foo-big
Selecting previously unselected package foo-small.
dpkg: regarding .../pool/foo-small_2_all.deb containing foo-small:
 bar conflicts with foo-small (<= 1)
  foo-small provides foo-small and is to be installed.

dpkg: error processing archive 
/tmp/tmp.oMkacgqZBY/aptarchive/pool/foo-small_2_all.deb (--unpack):
 conflicting packages - not installing foo-small
Errors were encountered while processing:
 /tmp/tmp.oMkacgqZBY/aptarchive/pool/foo-big_1_all.deb
 /tmp/tmp.oMkacgqZBY/aptarchive/pool/foo-small_2_all.deb
```
So:
1. dpkg has the same "bug", fixing apt alone wouldn't help.
   apt and dpkg are also far from the only tools reasoning about this.
2. While not perfect, the message from dpkg at least gives a much
   better hint at what is going on (it lacks the version number)

As such, I am leaving this open as a request to improve the error
reporting of the new solver in this situation.


Best regards

David Kalnischkies
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'

#insertinstalledpackage 'foo-big' 'all' '1' 'Provides: foo-big (= 2)'
#insertinstalledpackage 'foo-small' 'all' '2' 'Provides: foo-small (= 1)'
#insertinstalledpackage 'bar' 'amd64' '1' 'Conflicts: foo-big (>= 2), foo-small 
(<= 1)'
#dpkg -l bar foo-small foo-big
#dpkg -C

buildsimplenativepackage 'foo-big' 'all' '1' 'unstable' 'Provides: foo-big (= 
2)'
buildsimplenativepackage 'foo-small' 'all' '2' 'unstable' 'Provides: foo-small 
(= 1)'
buildsimplenativepackage 'bar' 'amd64' '1' 'unstable' 'Conflicts: foo-big (>= 
2), foo-small (<= 1)'

setupaptarchive

apt install bar foo-small foo-big

Attachment: signature.asc
Description: PGP signature

Reply via email to