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

Upgrading cabal-install fails on Windows #8884

Open
bgamari opened this issue Mar 30, 2023 · 1 comment
Open

Upgrading cabal-install fails on Windows #8884

bgamari opened this issue Mar 30, 2023 · 1 comment

Comments

@bgamari
Copy link
Contributor

bgamari commented Mar 30, 2023

Describe the bug
As far as I can tell, the recommended way to update cabal-install is:

$ cabal update
$ cabal install cabal-install

However, this fails on Windows due to that platform's restrictions on deleting running executables:

To Reproduce
Steps to reproduce the behavior:

$ cabal v2-install cabal-install --overwrite-policy=always
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.7.0.0 supports
'ghc' version < 9.4):
C:\msys64\home\ben\ghc-9.4.4-x86_64-unknown-mingw32\bin\ghc.exe is version
9.4.4
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.7.0.0 supports
'ghc' version < 9.4):
C:\msys64\home\ben\ghc-9.4.4-x86_64-unknown-mingw32\bin\ghc.exe is version
9.4.4
Resolving dependencies...
Up to date
Copying 'cabal.exe' to 'C:\Users\ben\AppData\Roaming\cabal\bin\cabal.exe'
C:\Users\ben\AppData\Roaming\cabal\bin\cabal.exe: DeleteFile "\\\\?\\C:\\Users\\ben\\AppData\\Roaming\\cabal\\bin\\cabal.exe": permission denied (Access is denied.)

Expected behavior
A new cabal-install is installed.

System information

  • Any Windows
  • Any cabal-install and ghc release

Additional context
It's a bit unclear how best to handle this. Perhaps cabal-install should gain a cabal upgrade command, which works around this limitation by first moving the old executable out of the way?

@jneira
Copy link
Member

jneira commented Apr 1, 2023

thanks for reporting it, I have hit it for years
my workaround (the trivial one) is set install-dir to an alternative location and replace the executable by hand
but yeah it should work out if the box and a very least add a note to install instructions

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

3 participants