Similar to the rest of the command line that is recorded, the program
path must also have spaces and backslashes escaped. Without this
parsing the recorded command line becomes hard on platforms like
Windows where spaces and backslashes are common.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 46825 Build 49471: arc lint + arc unit
Event Timeline
This LGTM, but could you add a simple test with a command-line that needs the escaping?
Multiple build bots were failing with the patch applied, see e.g. http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/4890/steps/test-check-clang/logs/FAIL%3A%20Clang%3A%3Aclang_f_opts.c
Seems like on platforms with a backslash for a directory separator you get "\\\\with\\ spaces\\\\clang" rather than "/with\\ spaces/clang", although I'm not completely sure that is what we want? I imagine platforms with \ as a separator have different escaping rules?
I reverted the commit for now; @ravi-ramaseshan is it OK if I just amend the test to look for "-record-command-line" "{{.+}}with\\ spaces{{.+}}" and we can worry about whether the other escaping is correct separately?
Hi Scott, thanks for checking. Sorry about not testing it on those platforms. I think "\\\\with\\ spaces\\\\clang" looks correct. That's what we would expect on those platforms. We could use "{{.+}}{{/|\\\\\\\\}}with\\ spaces{{/|\\\\\\\\}}clang{{.+}}" to be more deliberate that this is what we want.
I think amending the commit as you did looks good to me. Will you be able to amend the commit for this or should I post another review with the fix? I verified that on Windows your suggestion works.
Sorry for the delay; I can just commit this, no need to update the review. I will hopefully be back to a terminal to push it a bit later tonight.
Recommitted as 340feac6721e840f88c1e77dd79931eea5eaccf3, hopefully this version sticks, cheers!