[GHC] #13308: Treat leading whitespace in rts flag arguments in a uniform way

GHC ghc-devs at haskell.org
Mon Feb 20 12:37:04 UTC 2017


#13308: Treat leading whitespace in rts flag arguments in a uniform way
-------------------------------------+-------------------------------------
           Reporter:  AndreasK       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  lowest         |         Milestone:
          Component:  Runtime        |           Version:  8.0.2
  System                             |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #4243
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When parsing argument flags ghc treats leading whitespace different
 depending on the flag.

 * `ghc +RTS '-N 2' -s -RTS --version`
 Here '-N 2' is parsed as -N2
 * `ghc +RTS '-s file' -RTS --version`
 Here '-N 2' is parsed as '\ file', a filename starting with a space.
 * `ghc +RTS -N 2 -s -RTS --version`
 Here `2` is a unexpected argument.

 The usage info indicates no space is allowed in between flags and
 arguments making the first point a minor bug.

 It's never an issue when executing from a shell since it filters out
 unquoted spaces, however it can trip someone up when passing arguments
 explicitly via exec.

 If we remove leading spaces for file names however we make it impossible
 to use filenames starting with whitespace since we cant tell if the space
 was included by accident or quoted by the shell.
 But I also have never seen a file starting with whitespace that was
 created intentionally so maybe that is a worthwhile tradeoff.

 If the argument Parser #4243 ever get's rewritten maybe this could be made
 uniform one way or the other.

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


More information about the ghc-tickets mailing list