Skip to content

Instantly share code, notes, and snippets.

@AlainODea
Last active August 29, 2015 13:58
Show Gist options
  • Save AlainODea/10332328 to your computer and use it in GitHub Desktop.
Save AlainODea/10332328 to your computer and use it in GitHub Desktop.
Working around Cabal install getting "setup: /usr/bin/ld: permission denied" on SmartOS
#!/usr/bin/env bash
# assuming: pkgin -y install build-essential haskell-platform
git clone https://github.com/ghc/packages-unix.git
cd packages-unix/
git checkout -b smartos-fix-ghc-7.6.3 ghc-7.6.3-release
git apply ../patch-System-Posix-Files.hsc
autoreconf -i
cabal configure
cabal build
# this is an ugly hack
# I am preparing a patch for PKGSRC that solves this for the GHC 7.6.3 package directly
cabal install --force-reinstall
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc
index cb9663c..5f09b14 100644
--- a/System/Posix/Files.hsc
+++ b/System/Posix/Files.hsc
@@ -171,7 +171,7 @@ access name flags =
if (r == 0)
then return True
else do err <- getErrno
- if (err == eACCES)
+ if (err == eACCES || err == eROFS || err == eTXTBSY)
then return False
else throwErrnoPath "fileAccess" name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment