Opened 3 years ago

Closed 3 years ago

#5477 closed bug (fixed)

Missing space in Windows cmd.exe invocation breaks shell command invocation on Wine

Reported by: A1kmm Owned by:
Priority: normal Milestone:
Component: libraries/process Version: 7.2.1
Keywords: Cc:
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Consider this code example:

import System.Process

main = system "ghc --version"

When compiled and run on Wine, using process-1.1.0.0 or the latest version pushed to the git repository at the time of writing, the result is a cmd.exe prompt appears, rather than giving the current ghc version; the program exits when exit is typed into the shell without displaying the ghc version.

The reason for this is that System/Process/Internals.hs builds the command line like this: translate cmd ++ "/c " ++ string

The fact that there is no space between the path to cmd.exe and the /c argument causes Wine to ignore the /c flag (which would otherwise tell it to execute a command from the command line, rather than run in interactive mode).

I attach a patch which fixes this problem.

Attachments (1)

process-patch-wine.patch (601 bytes) - added by A1kmm 3 years ago.
Patch that makes system work correctly when compiled for Windows and run under Wine.

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by A1kmm

Patch that makes system work correctly when compiled for Windows and run under Wine.

comment:1 Changed 3 years ago by A1kmm

  • Status changed from new to patch

comment:2 Changed 3 years ago by igloo

  • Resolution set to fixed
  • Status changed from patch to closed

Applied, thanks:

commit 14900d31cbcf5166894871a2e7001e00d802248b
Author: Ian Lynagh <[email protected]>
Date:   Sun Sep 11 13:51:56 2011 +0100

    Fix "system" on wine; trac #5477

    A missing space in the Windows cmd.exe invocation broke shell command
    invocation on Wine. Patch from A1kmm.
Note: See TracTickets for help on using tickets.