Skip to content

actions: offer to remove leftover pacman download directories - #300

Open
ManDrake-hub wants to merge 1 commit into
CachyOS:developfrom
ManDrake-hub:fix-clear-download-dirs
Open

ManDrake-hub wants to merge 1 commit into
CachyOS:developfrom
ManDrake-hub:fix-clear-download-dirs

Conversation

@ManDrake-hub

Copy link
Copy Markdown

Fixes #210.

When a download is interrupted, pacman leaves download-* temporary directories in its cache. pacman -Sc cannot load them as packages, so it prints an error for each one ("could not open file …") and leaves them in place. "Clear package cache" now asks whether to remove them after the usual cleanup:

:: Remove 8 leftover directories from interrupted downloads? [Y/n]
  • Cache directories are read from pacman-conf CacheDir.
  • Nothing is done while /var/lib/pacman/db.lck exists, since a running transaction may still use them.
  • With an AUR helper (not escalated), removal uses sudo.

Tested on CachyOS with paru: the 8 leftover directories were removed. Added a unit test for the directory lookup; cargo clippy --all-targets -- -D warnings and cargo test pass on nightly.

When a download is interrupted, pacman leaves temporary `download-*`
directories in its cache. `pacman -Sc` cannot load them as packages,
so it prints an error for each one and leaves them in place. When
clearing the package cache, ask the user whether to remove them as
well. Skip this while the pacman database is locked, as a running
transaction may still be using them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ask user to clear temp download-* directories

1 participant