commercialhaskell / commercialhaskell/stack

renameDirectory fails once

Open
#6,774 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)

On windows, renameDirectory fails when installing new ghc version (only once).

### Steps to reproduce

1. Change your stack.yaml file to use a ghc configuration that has never been used before (e.g. move to the new lts-24.2).
2. Run command `stack test` on windows.

### Expected
The following behaviour is expected
```
PS C:\TorXakis> stack test
Preparing to install GHC to an isolated location. This will not interfere with any system-level installation.
Already downloaded ghc-9.10.2.
Already downloaded 7z.dll.
Already downloaded 7z.exe.
Decompressing ghc-9.10.2.tar.xz...

7-Zip 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15

Scanning the drive for archives:
1 file, 348217276 bytes (333 MiB)

Extracting archive: C:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-9.10.2.tar.xz
--
Path = C:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-9.10.2.tar.xz
Type = xz
Physical Size = 348217276
Method = LZMA2:26 CRC64
Streams = 1
Blocks = 18
Cluster Size = 201326592
Characteristics = BlockPackSize BlockUnpackSize

Everything is Ok

Size: 3446179840
Compressed: 348217276
Extracting ghc-9.10.2.tar...
Extracted total of 21 files from ghc-9.10.2.tar
GHC installed to C:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-9.10.2\.
```
### Actual
This behaviour is observed
```
PS C:\TorXakis> stack test
Preparing to install GHC to an isolated location. This will not interfere with any system-level installation.
Downloaded ghc-9.10.2.
Already downloaded 7z.dll.
Already downloaded 7z.exe.
Decompressing ghc-9.10.2.tar.xz...

7-Zip 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15

Scanning the drive for archives:
1 file, 348217276 bytes (333 MiB)

Extracting archive: C:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-9.10.2.tar.xz
--
Path = C:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-9.10.2.tar.xz
Type = xz
Physical Size = 348217276
Method = LZMA2:26 CRC64
Streams = 1
Blocks = 18
Cluster Size = 201326592
Characteristics = BlockPackSize BlockUnpackSize

Everything is Ok

Size: 3446179840
Compressed: 348217276
Extracting ghc-9.10.2.tar...
Extracted total of 21 files from ghc-9.10.2.tar
C:\Users\laarpjljvd\AppData\Local\Temp\stack-tmp-1f079d91757d6e41\ghc-9.10.2-x86_64-unknown-mingw32: renameDirectory:renamePath:MoveFileEx "\\\\?\\C:\\Users\\laarpjljvd\\AppData\\Local\\Temp\\stack-tmp-1f079d91757d6e41\\ghc-9.10.2-x86_64-unknown-mingw32" Just "\\\\?\\C:\\Users\\laarpjljvd\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-9.10.2": permission denied (Access is denied.)
```
Note by running `PS C:\TorXakis> stack test` again, I get the desired / expected behaviour.

### Stack version

```
PS C:\TorXakis> stack --version
Version 3.7.1, Git revision cfae313a06ea9f7278e0ac55a58341fa0440f1aa x86_64 hpack-0.38.1
```

### Method of installation

* Official binary, downloaded via haskellstack.org or from Stack's repository

### Platform

Windows

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.