-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Description
To reproduce:
- Add to the PATH a non-executable
git
file - Watch stack try and fail to execute that file, if needed when fetching.
$ > ~/.local/bin/git
$ ls -l ~/.local/bin/git
-rw-r--r--+ 1 pgiarrusso staff 0 Aug 14 11:22 /Users/pgiarrusso/.local/bin/git
$ stack build --dry-run
/Users/pgiarrusso/.local/bin/git: streamingProcess: runInteractiveProcess: exec: permission denied (Permission denied)
$ stack upgrade
Fetching package index .../Users/pgiarrusso/.local/bin/git: createProcess: runInteractiveProcess: exec: permission denied (Permission denied)
For the failure to occur on build, the package needs git dependencies, for instance:
resolver: lts-6.6
packages:
- '.'
- location:
git: https://github.com/agda/agda
commit: e3472d7c1441c0d6db66be9e094e9dbcb7c33735
I noticed this by chance while debugging #2241. I can't remove Git from OS X 10.11, but I tried shadowing it with a failing one and made a mistake.
The bug is thankfully not in the process
package. Nor is stack
itself doing the lookup—the bug is somewhere between System.Process.Read
and its supporting libraries. BTW, System.Process.Read
appears confusing to me.
$ stack runghc ./runProcess.hs
git version 2.9.0
First git done
git version 2.9.0
runProcess.hs
:
import System.IO
import System.Process
args = ["--version"]
main = do
(_, _, _, ph) <- createProcess (proc "git" args)
ec <- waitForProcess ph
hPutStrLn stderr "First git done"
ph <- runProcess "git" args Nothing Nothing Nothing Nothing Nothing
ec <- waitForProcess ph
return ()
mgsloan