Escape multiple arguments in the settings file
Uses responseFile syntax. The issue arises when GHC is installed on windows into a location that has a space, for example the user name is 'Fake User'. The $topdir will also contain a space, consequentially. When we resolve the top dir in the string `-I$topdir/mingw/include`, then `words` will turn this single argument into `-I/C/Users/Fake` and `User/.../mingw/include` which trips up the flag argument parser of various tools such as gcc or clang. We avoid this by escaping the $topdir before replacing it in `initSettngs`. Additionally, we allow to escape spaces and quotation marks for arguments in `settings` file. Add regression test case to count the number of options after variable expansion and argument escaping took place. Additionally, we check that escaped spaces and double quotation marks are correctly parsed.
Showing
- compiler/GHC/Settings/IO.hs 30 additions, 8 deletionscompiler/GHC/Settings/IO.hs
- hadrian/src/Rules/Generate.hs 25 additions, 8 deletionshadrian/src/Rules/Generate.hs
- test.hs 14 additions, 0 deletionstest.hs
- testsuite/tests/ghc-api/settings-escape/T11938.hs 136 additions, 0 deletionstestsuite/tests/ghc-api/settings-escape/T11938.hs
- testsuite/tests/ghc-api/settings-escape/T11938.stderr 12 additions, 0 deletionstestsuite/tests/ghc-api/settings-escape/T11938.stderr
- testsuite/tests/ghc-api/settings-escape/all.T 5 additions, 0 deletionstestsuite/tests/ghc-api/settings-escape/all.T
- testsuite/tests/ghc-api/settings-escape/ghc-install-folder/lib/.gitkeep 0 additions, 0 deletions...s/ghc-api/settings-escape/ghc-install-folder/lib/.gitkeep
- testsuite/tests/ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep 0 additions, 0 deletions...ghc-api/settings-escape/ghc-install-folder/mingw/.gitkeep
Loading
Please register or sign in to comment