Cabal install should be smarter about /tmp mounted with noexec
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
```
Executing: dist/dist-sandbox-82ddaa05/build/Data/Yaml/Syck_hsc_make >dist/dist-sandbox-82ddaa05/build/Data/Yaml/Syck.hs
running dist/dist-sandbox-82ddaa05/build/Data/Yaml/Syck_hsc_make failed (exit code 127)
command was: dist/dist-sandbox-82ddaa05/build/Data/Yaml/Syck_hsc_make >dist/dist-sandbox-82ddaa05/build/Data/Yaml/Syck.hs
World file is already up to date.
cabal: Error: some packages failed to install:
...
```
It happened to me with 5 packages already and I worked around it by installing the lib as system package. Generally, this shows as , , "_hsc_make failed (exit code 127)".
The main problem is my /tmp was mounted noexec. Now, you can parse /proc/self/mountinfo and check for that before trying to exec things from there.
Other problem is that I was not even aware it is using /tmp. The output looks like it's running in the $(pwd)/dist/. `cabal install ` doesn't show it. It shows with -v2 but just at the start, which never occured to me to look at since the error happens several pages down the build log.
And last problem is that it was incredibly difficult to debug. Thanks a lot to @dcoutts there. Big part of that is thanks to the fact that the build environment is dropped regardless of the build result. This (and other build failures) would probably be way easier to debug if the build environment was kept intact and cabal would also tell you the absolute path there, right below the error. At least that's what I'm used to when dealing with package build failures on gentoo or suse.
Contributor guide
Assessment
This issue has not been assessed yet.