[GHC] #13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 8.0.2 System | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Starting a executable like this: app -- arg1 +RTS -s -RTS arg2 Windows and Linux pass different arguments on to the application: * Windows: `["--","arg1","arg2"]` * Linux: `["--","arg1","+RTS","-s","-RTS","arg2"]` If we want uniform behavior we need to change one of these. Given the existence of the --RTS flag I'm not sure if the Linux behavior was intended however it matches the behavior you would expect in the *nix world nicely. Therefore changing the behavior on Windows would make more sense. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by AndreasK): * owner: (none) => AndreasK -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AndreasK): There is already a issue for reworking the argument parser: #4243 (Make a proper options parser for the RTS) Using a unified parser would certainly fix this behavior as well. There is also interesting behaviour with -rtsopts=none * `app -- +RTS arg1` get's silently ignored * `app +RTS arg1` gives a warning (as expected) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * priority: normal => high * milestone: => 8.2.1 Comment: Thank you! I was baffled by this behavior in the context of a stack ticket (on phone, so not going to look for it now). With your hints I now understand more or less what is going on. The difference between `--` and `--RTS` is that the former is passed on to the program, while the latter is not. It's intentional and documented at least in the code which implements it, and I think in the user's guide also. Let's just fix this for 8.2 (should be a one line change) and worry about cleaning up the weird command line stuff we do on Windows after that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AndreasK): The issue was slightly more complicated than expected. * The runtime parses arguments correctly and ignores RTS flags past `--` * On linux `getArgs` fetches the arguments from the runtime and returns these as expected. * On Windows `getArgs` ignores the arguments provided by the RTS and instead uses `GetCommandLineW` to get the arguments, parsing these and throwing out any RTS flags without parsing them. The issue is that the code throwing out RTS flags didn't consider the case of `--` resulting in the above behavior. I see two ways to fix this: * Update the parsing code in base (easy). * Use getCommandLineW and consorts instead of argv in the RTS on Windows. (A more proper fix). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Let's do the first, easy thing for 8.2 (soon). Then the more proper fix as time permits. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T13287 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3147 Wiki Page: | -------------------------------------+------------------------------------- Changes (by AndreasK): * testcase: => T13287 * differential: => Phab:D3147 Comment: I implemented the simple fix together with a testcase. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: patch Priority: high | Milestone: 8.2.1 Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T13287 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3147 Wiki Page: | -------------------------------------+------------------------------------- Changes (by AndreasK): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13287: The runtime parses arguments past -- under windows but passes them on as
arguments on linux
-------------------------------------+-------------------------------------
Reporter: AndreasK | Owner: AndreasK
Type: bug | Status: patch
Priority: high | Milestone: 8.2.1
Component: Runtime System | Version: 8.0.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Other | Test Case: T13287
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3147
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#13287: The runtime parses arguments past -- under windows but passes them on as arguments on linux -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Runtime System | Version: 8.0.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T13287 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3147 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13287#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC