Pacman

Historical bug tracker for the Pacman package manager.

The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues

This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
Tasklist

FS#57667 - [pacman-contrib] paccache does not respect CleanMethod = KeepInstalled in pacman.conf

Attached to Project: Pacman
Opened by Maxim Baz (maximbaz) - Tuesday, 27 February 2018, 18:41 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 27 February 2018, 19:57 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version git
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The default value for CleanMethod is KeepInstalled, it means that `pacman -Sc` should remove cached packages that are no longer installed.

paccache however does not detect uninstalled packages and thus leaves them in cache.

A common scenario would be:

- Install packageA
- Understand that you don't need packageA, remove it
- Run paccache -r to cleanup the cache

Expected:
- With CleanMethod = KeepInstalled, packageA should be removed from the cache

Actual:
- packageA is left in cache forever.
This task depends upon

Closed by  Dave Reisner (falconindy)
Tuesday, 27 February 2018, 19:57 GMT
Reason for closing:  Works for me
Additional comments about closing:  Working as intended. A two-step process is required here.
Comment by Dave Reisner (falconindy) - Tuesday, 27 February 2018, 18:52 GMT
paccache has a -u flag to target uninstalled packages. It's not meant to read pacman.conf.
Comment by Maxim Baz (maximbaz) - Tuesday, 27 February 2018, 19:04 GMT
Huh, I completely missed the -u flag, thanks for the pointer. But I'm not sure how to use it for the scenario I described - I want to keep 3 cached copies of packages that I have installed and 0 cached copies of packages that I do not have installed. If I installed and immediately removed a package, I will have one entry in cache - and I want to get rid of it. Running `paccache -du` doesn't detect it, only running `paccache -du -k 0` - but this also attempts to remove all cached copies of packages that I have installed, which is completely not what I want.

To be honest, it's a bit weird that paccache is meant to read pacman.conf for the list of cachedirs, but not for the clean method for these cachedirs, but I'm fine with a CLI flag as long as I can make it work.
Comment by Dave Reisner (falconindy) - Tuesday, 27 February 2018, 19:08 GMT
You'll have to invoke paccache twice to get what you want.
Comment by Maxim Baz (maximbaz) - Tuesday, 27 February 2018, 19:23 GMT
I'm not against that, but as I described `paccache -du -k 0` removes too much, it removes not only uninstalled packages, but all cached packages.
Comment by Dave Reisner (falconindy) - Tuesday, 27 February 2018, 19:36 GMT
> it removes not only uninstalled packages, but all cached packages.
That's not the behavior I see, and it isn't how the code reads. Could you squint harder at the output of paccache and ensure that it really is removing *installed* packages with the -u flag? If so, please supply the output of 'bash -x paccache -duk0'
Comment by Maxim Baz (maximbaz) - Tuesday, 27 February 2018, 19:46 GMT
You are completely right, I misinterpreted the output, it works as expected. Thank you, and I apologize for the confusion!

Should I close the ticket then? `paccache -r; paccache -ruk0` is an acceptable solution to me.

Loading...