Treat leading whitespace in rts flag arguments in a uniform way
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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | lowest |
Resolution | Unresolved |
Component | Runtime System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |