Skip to content

Conversation

iquiw
Copy link
Contributor

@iquiw iquiw commented Aug 23, 2014

Copied from https://ghc.haskell.org/trac/ghc/ticket/9393

If PATH environment variable contains non directory component,
execvpe fails by ENOTDIR.

For example, if "/tmp/foo" is a regular file, the following program fails with PATH contains "/tmp/foo".

module Main where

import System.Environment
import System.Posix.Process

main :: IO ()
main = do
    env <- getEnvironment
    executeFile "echo" True [] (Just env)
    return ()
$ PATH=/tmp/foo:$PATH runghc a.hs   
a.hs: echo: executeFile: inappropriate type (Not a directory)

See for example, ​haskell/cabal#1723

If PATH environment variable contains non directory component,
execvpe failed by ENOTDIR.
hvr added a commit that referenced this pull request Dec 6, 2014
The previous code was prone to conflicts with when the platform happens
to expose a `execvpe(3)` implementation in its libc.

This commit renames the internal implementation to `__hsunix_execvpe` as
well as adding an autoconf-detection for the presence of `execvpe(3)`,
in which case `__hsunix_execvpe()` forwards the call to `execvpe(3)`.

Moreover, the code has been cleaned up to remove likely bitrotted CPP
conditionals.

This should fix #22

(This also partially addresses #11 on platforms which have a
libc-provided `execvpe(3)`)
@hvr hvr closed this in 558b0fb Dec 6, 2014
@hvr hvr modified the milestone: 2.7.1.0 Dec 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants