commercialhaskell / commercialhaskell/stack
Windows: .../ghc-9.4.8/mingw/bin/strip.exe: error: Permission denied
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
While building `happy-1.20.1.1` with GHC 9.4.8 on Windows in CI, @hausfell experienced:
~~~text
happy > .../ghc-9.4.8/mingw/bin/strip.exe: error: Permission denied
~~~
This was during the `Setup.hs copy` step, which sees Cabal (the library), by default, run `strip` after having moved the executable file to a new location. For example, during `stack --verbose build --cabal-verbose --ghc-options=-v`:
~~~text
2024-07-19 18:17:18.401203: [info] creating
2024-07-19 18:17:18.401203: [info] ...\happy-1.20.1.1\.stack-work\install\fd1b2601\bin
2024-07-19 18:17:18.401203: [info] Installing executable .stack-work\dist\f1a1ac53\build\happy\happy.exe to
2024-07-19 18:17:18.401203: [info] ...\happy-1.20.1.1\.stack-work\install\fd1b2601\bin\happy.exe
2024-07-19 18:17:18.401203: [info] "...\ghc-9.4.8\mingw\bin\strip.exe" "...\happy-1.20.1.1\.stack-work\install\fd1b2601\bin\happy.exe"
~~~
I think it must be `strip.exe` seeking to overwrite `happy.exe` when it is not yet free to do so, for some reason.
Cabal's `Distribution.Simple.GHC.installExe` has (extract):
~~~haskell
installBinary dest = do
installExecutableFile
verbosity
(buildPref exeName' exeFileName)
(dest <.> exeExtension (hostPlatform lbi))
when (stripExes lbi) $
Strip.stripExe
verbosity
(hostPlatform lbi)
(withPrograms lbi)
(dest <.> exeExtension (hostPlatform lbi))
~~~
So, it looks to me that things are properly sequenced. Could it be a problem within the MSYS2-supplied `strip.exe` itself?
Contributor guide
Assessment
This issue has not been assessed yet.