System.Cmd.system tries to execve("n/sh", ...)

David Hughes David.W.Hughes at cern.ch
Fri Oct 18 05:54:07 EDT 2002


I find it hard to see how a bug like this could get into a GHC
release, since it appears to break the build.  But, I don't know of
anything wrong with the platform I'm running it on, and in general my
setup looks okay (rpm --verify, etc).  So, does anyone reproduce this?

I'm running GHC 5.04-1 installed from RPM on a RedHat 7.2 x86 box.

Here's the problem:

     $ cat sys.hs
     module Main where
     import System.Cmd
     main = system "/bin/false" >>= print

     $ ghc sys.hs
     $ ./a.out
     ExitFailure 127

If I "strace" it then I find that it's missing the first three
characters of "/bin/sh":

     $ strace -f -efork,execve ./a.out
     execve("./a.out", ["./a.out"], [/* 74 vars */]) = 0
     fork()                                  = 13065
     [pid 13065] execve("n/sh", ["/bin/sh", "-c", "/bin/false"], [/* 74
vars */]) = -1 ENOENT (No such file or directory)
     --- SIGCHLD (Child exited) ---
     ExitFailure 127

Of course my program works fine if I create a symlink "./n/sh ->
/bin/sh".  I used this trick to build the latest GHC out of CVS, but I
had an apparently-unrelated problem (it produces ".hi" files, but not
".o").  So I don't know if the problem's still there.

Regards,
// David
-- 
David Hughes
UNIX sysadmin, Serco SA         -+-         Tel.: +41 22 767 4047
Computing Centre, CERN          -+-        David.W.Hughes at cern.ch







More information about the Glasgow-haskell-bugs mailing list