-
-
Couldn't load subscription status.
- Fork 258
Support response files with quoted args #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
CI is red |
This was because some args are like |
The cc_wrapper.sh scripts inspects response files and sanitizes each line within them. How the logic is structured currently causes all of these arguments to the be directly used later in the script. This can run into argument overflows. It can also run into problems where quoting in response files and from args is treated differently. This addresses some of the comments in bazel-contrib#430, namely cleaning up files and not overwriting the input files. I have not tried to apply a threshold here as that is best left up to the tooling that previously decided to use response files, which can cause difficult to debug changes in behavior. This conflicts with bazel-contrib#479, but is trying to address the same underlying problem of quoted arguments in response files as the result of golang's link actions. Fixes bazel-contrib#421
The cc_wrapper.sh scripts inspects response files and sanitizes each line within them. How the logic is structured currently causes all of these arguments to the be directly used later in the script. This can run into argument overflows. It can also run into problems where quoting in response files and from args is treated differently. This addresses some of the comments in #430, namely cleaning up files and not overwriting the input files. I have not tried to apply a threshold here as that is best left up to the tooling that previously decided to use response files, which can cause difficult to debug changes in behavior. This conflicts with #479, but is trying to address the same underlying problem of quoted arguments in response files as the result of golang's link actions. Fixes #421
|
@faximan Could you rebase and resolve the conflict? |
#245 introduced a regression where clang response files were read and expanded into args on the command line.
This was a regression because response files support quoted args:
but
cc_wrapper.shwill expand this toThis is not just a theoretical concern: golang (which is using a c++ linker for its cgo integration) is explicitly quoting its strings in the response files: https://github.com/golang/go/blob/ecc06f0db79193a4fe16138148c7eb26d9af96f1/src/cmd/link/internal/ld/lib.go#L2123-L2124
This PR solves this by processing what's inside the quotes instead of the string as a whole. As a bonus, this will also support multiple (quoted or unquoted) args on a single line, which is something clang supports but toolchains_llvm does not. The fix is inspired by https://stackoverflow.com/a/17346794 but modified to support args starting with
$(need to be passed through).Note that another related fix is #430, which passes through the response files to clang. That PR would also be great to support very long arg lists, but we still need this PR to properly call
sanitize_optionfor quoted args.