Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Garbage collecting cache fails when using XDG directories #810

Closed
tfausak opened this issue Mar 18, 2023 · 1 comment
Closed

Garbage collecting cache fails when using XDG directories #810

tfausak opened this issue Mar 18, 2023 · 1 comment

Comments

@tfausak
Copy link
Contributor

tfausak commented Mar 18, 2023

With GHCUP_USE_XDG_DIRS=1 set, running ghcup gc --cache fails for me:

vscode ➜ /workspaces/scratch $ env | grep -i ghcup
GHCUP_USE_XDG_DIRS=1

vscode ➜ /workspaces/scratch $ ghcup --version
The GHCup Haskell installer, version v0.1.19.2-8-gc20dece

vscode ➜ /workspaces/scratch $ ghcup gc --cache
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /home/vscode/.cache/ghcup/ghcup-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  232k  100  232k    0     0  2347k      0 --:--:-- --:--:-- --:--:-- 2347k
[ Warn  ] New ghc version available. If you want to install this latest version, run 'ghcup install ghc 9.6.1'
ghcup: /home/vscode/.cache/ghcup/tmp: removeLink: inappropriate type (Is a directory)

vscode ➜ /workspaces/scratch $ ls -A -l ~/.cache/ghcup/tmp
total 0
@hasufell
Copy link
Member

$ ls ~/.cache/ghcup/
 db   ghcup-0.0.6.yaml   ghcup-0.0.6.yaml.etags   ghcup-0.0.7.yaml   ghcup-0.0.7.yaml.etags   logs   tmp

This doesn't work, because ghcup gc --cache expects the cache dir to only have files. It will refuse to delete directories (because it's unsafe).

There are two things we need to do:

  1. we should use a subdir ~/.cache/ghcup/cache
  2. ~/.cache/ghcup/db should in fact live in ~/.local/share/ghcup/db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants