Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some execution functions lookup files incorrectly #2489

Closed
Blaisorblade opened this issue Aug 14, 2016 · 2 comments
Closed

Some execution functions lookup files incorrectly #2489

Blaisorblade opened this issue Aug 14, 2016 · 2 comments
Assignees
Milestone

Comments

@Blaisorblade
Copy link
Collaborator

@Blaisorblade Blaisorblade commented Aug 14, 2016

To reproduce:

  1. Add to the PATH a non-executable git file
  2. 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 ()
@Blaisorblade
Copy link
Collaborator Author

@Blaisorblade Blaisorblade commented Aug 14, 2016

BTW, all that was on OS X, I haven't rechecked on Linux yet.

@Blaisorblade
Copy link
Collaborator Author

@Blaisorblade Blaisorblade commented Aug 14, 2016

Ah, I had missed stack's findExecutable, the bug must be there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants