[GHC] #7654: Cannot specify argv[0] with createProcess

#7654: Cannot specify argv[0] with createProcess -----------------------------+---------------------------------------------- Reporter: MtnViewMark | Owner: Type: feature request | Status: new Priority: normal | Component: libraries/process Version: 7.6.2 | Keywords: process Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- There are conditions where it is important to specify the value of argv[0] as distinct from the FilePath of the file to execute. When createProcess is called with CmdSpec (inside the CreateProcess argument) of RawCommand, the code in System.Process.Internals.runGenProcess_ builds the argv list by concatenating the FilePath of the command to run on to the supplied args, then passing that array to the c code runInteractiveProcess. runInteractiveProcess in turn uses argv[0] as the initial argument to either execvp() or execvpe(). Thus, argv[0], and the command to execute must be the same. The fix is simple, but long.... runInteractiveProcess should take an adiditional parameter that is the command to exec, distinct from the args array (which continues to hold the now distinct argv[0]). runGenProcess_ should keep cmd and args distinct, and build cstrs from args, not cmd:args. commandToProcess needs to then take on the work of prepending the cmd to the args array, in the case of RawCommand or ShellCommand. NOW, we can introduce a new constructore RawCommandWithArg0 FilePath String [String] where argv[0] is specified, and commandToProcess for that can easily build the args from that parameter. I should probably prepare a patch for this.... But I wanted to get the ticket in as the issue was fresh in my mind. This is a feature request, but realize that without a change, an important part of POSIX support is missing. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7654 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7654: Cannot specify argv[0] with createProcess ----------------------------------+----------------------------------------- Reporter: MtnViewMark | Owner: MtnViewMark Type: feature request | Status: new Priority: normal | Milestone: Component: libraries/process | Version: 7.6.2 Keywords: process | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------+----------------------------------------- Changes (by igloo): * owner: => MtnViewMark * difficulty: => Unknown Comment: A patch would be great; please see http://www.haskell.org/haskellwiki/Library_submissions for details. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7654#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7654: Cannot specify argv[0] with createProcess ----------------------------------+----------------------------------------- Reporter: MtnViewMark | Owner: MtnViewMark Type: feature request | Status: infoneeded Priority: normal | Milestone: Component: libraries/process | Version: 7.6.2 Keywords: process | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------+----------------------------------------- Changes (by igloo): * status: new => infoneeded -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7654#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7654: Cannot specify argv[0] with createProcess ----------------------------------+----------------------------------------- Reporter: MtnViewMark | Owner: MtnViewMark Type: feature request | Status: infoneeded Priority: normal | Milestone: Component: libraries/process | Version: 7.6.2 Keywords: process | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------+----------------------------------------- Comment(by simonmar): Is it possible to do this without breaking the API too much? I have in mind adding a new field to `CreateProcess`: {{{ data CreateProcess = CreateProcess { ... argv0 :: Maybe String } }}} and leave the rest of the public API as it is. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7654#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7654: Cannot specify argv[0] with createProcess --------------------------------+------------------------------------------- Reporter: MtnViewMark | Owner: MtnViewMark Type: feature request | Status: closed Priority: normal | Milestone: Component: libraries/process | Version: 7.6.2 Resolution: wontfix | Keywords: process Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: --------------------------------+------------------------------------------- Changes (by igloo): * status: infoneeded => closed * resolution: => wontfix Comment: I'm going to close this ticket until we've reached consensus on the libraries list, as per the library submissions policy. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7654#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC