FS#59072 - [pacman-contrib] pactree incorrectly resolves versioned dependencies into package-provider

Attached to Project: Community Packages
Opened by dervish (dervish) - Tuesday, 19 June 2018, 19:18 GMT
Last edited by Johannes Löthberg (demize) - Saturday, 25 August 2018, 18:47 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Johannes Löthberg (demize)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I noticed that 'pactree' produces different results for local and sync databases:

$ pactree -d1 gptfdisk
gptfdisk
├─gcc-libs
├─popt
├─lib32-util-linux provides libuuid.so <---difference
└─ncurses provides libncursesw.so

$ pactree -sd1 gptfdisk
gptfdisk
├─gcc-libs
├─popt
├─libutil-linux provides libuuid.so <---difference
└─ncurses provides libncursesw.so

The package 'gptfdisk' explicitly depends on 'libuuid.so=1-64'

$ pacman -Qi gptfdisk | grep Depends
Depends On: gcc-libs popt libuuid.so=1-64 libncursesw.so=6-64
^^^^^^^^^^^^^^^

There are two providers for 'libuuid.so':

$ pacman -Qi libutil-linux | grep Provides
Provides: libuuid.so=1-64 libblkid.so=1-64 libfdisk.so=1-64 libmount.so=1-64
^^^^^^^^^^^^^^^
$ pacman -Qi lib32-util-linux | grep Provides
Provides: libuuid.so=1-32 libblkid.so=1-32 libfdisk.so=1-32 libmount.so=1-32
^^^^^^^^^^^^^^^
When traversing the 'gptfdisk's dependency tree 'pactree' should use 'libutil-linux'. And it finds it by explicitly specifying the version. But without version it chooses lib32-util-linux.

$ pactree -d0 libuuid.so=1-64
libutil-linux provides libuuid.so=1-64

$ pactree -d0 libuuid.so
lib32-util-linux provides libuuid.so

So, in such cases, 'pactree' prints an incorrect dependency tree for the local database.


Package versions:
pacman 5.1.0-2
pacman-contrib 1.0.0-2

Forum's topic:
https://bbs.archlinux.org/viewtopic.php?pid=1791951
This task depends upon

Closed by  Johannes Löthberg (demize)
Saturday, 25 August 2018, 18:47 GMT
Reason for closing:  Fixed
Additional comments about closing:  1.1.0-1
Comment by (arisinfenix) - Wednesday, 20 June 2018, 14:35 GMT
In pactree.c line 448 alpm_find_dbs_satisfier() is called. This is the functions description.

/** Find a package satisfying a specified dependency.
* First look for a literal, going through each db one by one. Then look for
* providers. The first satisfier found is returned.
* The dependency can include versions with depmod operators.

Important part: The first satisfier found is returned.

Seems the issue is related to how the db entries are ordered (alphabetically?) and in which order the dbs are listed in pacman.conf.
In case of local db I guess 'lib32-util-linux' is before 'libutil-linux' and so the first satisfier found.

If I put [multilib] above all other repos in pacman.conf 'pactree -sd1 gptfdisk' also prints 'lib32-util-linux'.

$ pactree -sd1 gptfdisk
gptfdisk
├─gcc-libs
├─popt
├─lib32-util-linux provides libuuid.so
└─ncurses provides libncursesw.so

Comment by Johannes Löthberg (demize) - Wednesday, 20 June 2018, 16:02 GMT Comment by dervish (dervish) - Wednesday, 20 June 2018, 18:18 GMT
Yes, it works for me!

After recompilation:
./pactree -d1 gptfdisk
gptfdisk
├─gcc-libs
├─popt
├─libutil-linux provides libuuid.so=1-64
└─ncurses provides libncursesw.so=6-64

Great! Thanks, Johannes Löthberg (Kyrias)!

Loading...