[GHC] #13676: Command line written to stats file by the rts is not executable

#13676: Command line written to stats file by the rts is not executable -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 8.0.1 System | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Debugging Unknown/Multiple | information is incorrect Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The first line of the stats file output by the rts is the invocation of the program. However the "s around arguments are not present in that line. For example: {{{ $ ghc +RTS -trts-test -RTS -e "do {putStrLn\$ show [1,2] ++ (\"(\\\\haskell)\")}" &>/dev/null && cat rts-test | head -n 1 /opt/ghc/8.0.2/lib/ghc-8.0.2/bin/ghc -B/opt/ghc/8.0.2/lib/ghc-8.0.2 -e do {putStrLn$ show [1,2] ++ ("(\\haskell)")} +RTS -trts-test }}} I would expect that this line could be pasted into a shell to invoke the command, however this is not the case as evidenced above. There are several issues evidenced by the above example: * the quoted argument "do {...}" does not have quotes in the output. I believe this is a true bug. * the $,"s and \s inside the quoted argument are not escaped. I'm fairly sure that at least the "s and \s should be escaped. Not so sure that $ should be, since a shell isn't the only way to run a program. * The +RTS options are moved to the end. This is seems intentional and doesn't change semantics, but it seems better to be exactly the same. The relevant code is in initStatsFile in RtsFlags.c I'd suggest quoting each argument, escaping at least "s and \s inside arguments and thinking about whether escaping other shell characters like $ is a good idea. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13676 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13676: Command line written to stats file by the rts is not executable -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by duog): * version: 8.0.1 => 8.0.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13676#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13676: Command line written to stats file by the rts is not executable -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by duog): The same issues is present in at least the Profiling Report, grep for prog_argv. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13676#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC