[GHC] #9673: aarch64 7.8.4, 7.10, 7.11: lib/ghc/bin/ghc-pkg --version does not output from subprocess

GHC ghc-devs at haskell.org
Thu Apr 9 05:55:19 UTC 2015


#9673: aarch64 7.8.4, 7.10, 7.11: lib/ghc/bin/ghc-pkg --version does not output
from subprocess
-------------------------------------+-------------------------------------
        Reporter:  juhpetersen       |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1-rc1
      Resolution:                    |                Keywords:
Operating System:  Linux             |            Architecture:  aarch64
 Type of failure:  Installing GHC    |               Test Case:
  failed                             |                Blocking:
      Blocked By:                    |  Differential Revisions:
 Related Tickets:                    |
-------------------------------------+-------------------------------------

Comment (by erikd):

 Have a tiny test program (trimmed down version of
 `Distribution.Simple.Utils.rawSystemStdInOut` running the problem
 arguments) as follows:

 {{{#! hs
 import System.IO
 import System.Exit      ( ExitCode(..) )
 import Control.Concurrent
 import Control.Monad
 import Control.Exception (evaluate, finally)
 import System.Environment

 import System.Process

 main :: IO ()
 main = do
   [path] <- getArgs --  "/home/erikd/GHC/7.11/bin/ghc-pkg" -- "/usr/bin
 /ghc-pkg"
   runInteractiveProcess path ["--version"] Nothing Nothing >>=
     \(inh,outh,errh,pid) -> do

       err <- hGetContents errh
       out <- hGetContents outh

       mv <- newEmptyMVar
       let force str = (evaluate (length str) >> return ())
             `finally` putMVar mv ()
           --TODO: handle exceptions like text decoding.
       _ <- forkIO $ force out
       _ <- forkIO $ force err

       -- wait for both to finish, in either order
       takeMVar mv
       takeMVar mv

       -- wait for the program to terminate
       exitcode <- waitForProcess pid
       unless (exitcode == ExitSuccess) $
         print $ path ++ " returned " ++ show exitcode
                        ++ if null err then "" else
                           " with error message:\n" ++ err

       print (out, err, exitcode)
 }}}

 Compiling and running this in a couple of different ways results in some
 interesting results:

 {{{
 $ /usr/bin/ghc-7.6.3 --make test.hs -o prog && ./prog  /usr/bin/ghc-pkg
 Linking prog ...
 ("GHC package manager version 7.6.3\n","",ExitSuccess)
 $ /usr/bin/ghc-7.6.3 --make test.hs -o prog && \
                          ./prog /home/erikd/GHC/7.11/bin/ghc-pkg
 ("","",ExitSuccess)
 }}}

 This may be an output encoding issue as the `TODO` warning in the code
 warns about.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9673#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list