FS#59711 - Dependency loop makes impossible to find unused dependency (ffmpeg in my case)

Attached to Project: Pacman
Opened by Manuel Reimer (M-Reimer) - Saturday, 18 August 2018, 18:48 GMT
Task Type Bug Report
Category General
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 5.1.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 2
Private No

Details

Summary and Info:
Since probably the last Pacman update a

# pacman -Qdt

and even

# pacman -Qdtt

no longer report ffmpeg as unused even if installed as "--asdeps". I needed several hours to find a potential reason, but it seems like ffmpeg depends on x264 which, on the other hand, depends on ffmpeg. So the two packages seem to depend on each other which causes some kind of "dependency loop" where none of them is "unused" anymore.

Steps to Reproduce:

Install ffmpeg with "--asdeps" on a "clean" (just base and probably base-devel) virtual machine.

Run pacman -Qdtt.

Espected behaviour: ffmpeg should be reported as unused dependency but is not.
This task depends upon

Comment by Manuel Reimer (M-Reimer) - Saturday, 18 August 2018, 18:55 GMT
Even easier to reproduce on *any* system where ffmpeg can be (temporarily) uninstalled.

Run

# pacman -Rsc ffmpeg

followed by

# pacman -S --asdeps ffmpeg

now ffmpeg should be reported by

# pacman -Qdtt

right? Wrong!
Comment by Andrew Gregory (andrewgregory) - Sunday, 18 November 2018, 00:32 GMT
I'm not sure why you would expect ffmpeg to be listed. If it and x264 depend on each other, neither is unrequired, so neither will show up with -t.
Comment by Manuel Reimer (M-Reimer) - Sunday, 18 November 2018, 09:20 GMT
Exactly that's the problem. Effectively it is not possible for ffmpeg to get ever "unrequired".
Here, pacman needs a bit more "intelligence" to detect this "internal loop".
Comment by Andrew Gregory (andrewgregory) - Sunday, 18 November 2018, 16:48 GMT
You've not actually clarified anything. -t only lists unrequired packages; both ffmpeg and x264 are required, so why would either show up in a list of unrequired packages? If you installed a package foo with the following dependency chain 'foo -> bar -> baz -> quux -> foo' would you really expect -Qt to list all four packages?
Comment by Manuel Reimer (M-Reimer) - Friday, 23 November 2018, 09:56 GMT
Actually this is what I expect. I expect pacman to have a bit more "intelligence" here.

If all "real" users of ffmpeg are gone, then I expect pacman to show me ffmpeg with its dependencies as "unused". This "internal loop" should be unrolled.

If you think that "-Qdtt" shouldn't be able to ever list ffmpeg as "unused", then please provide some other mechanism so I can know which packages on my system are not *really* used by other packages.
Comment by Andrew Gregory (andrewgregory) - Friday, 23 November 2018, 17:09 GMT
x264 is a real user. If you mean an explicitly installed user, `comm -23 <(pacman -Qqd | sort -u) <(pacman -Qqe | xargs -n1 pactree -u | sort -u)`
Comment by Manuel Reimer (M-Reimer) - Monday, 24 December 2018, 15:51 GMT
In the end it's up to you.

This "comm ..." line is really hard to use in scripts. Requires to run some external shell to work. I think there should at least be some simple command line option to print out everything that can be uninstalled as soon as the "explicitly installed" users are gone.

I thought that that's exactly what "pacman -Qdt" is meant for.

User's don't care much about the internal details and IMHO it is bad that ffmpeg somewhat "self locks" itself from getting uninstalled "the easy way" as pacman isn't smart enough to just ignore locking "circular dependencies" that are part of the repository.
Comment by Eli Schwartz (eschwartz) - Monday, 24 December 2018, 22:02 GMT
pacman -Qdt is there to give you a list of packages which could be (safely) removed due to not being dependencies of anything nor being explicitly installed. But something in a dependency loop cannot be safely removed on its own, because it will break its codependent package. It's only safe to remove them both at the same time, and IMO is unsuitable for -Qdt output.

Note that pacman -Rns will know how to remove them both, when recursively removing the dependencies of a third package. This is possible because there's an explicit list of dependencies to remove, and all that is needed is to remove each one that has a valid removal path.

Loading...