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
Expansion of $(location) on path with spaces quotes too many times #6531
Comments
Not sure if this is Starlark or Execution. We'll have to sort it out. |
Related to #3475 |
The |
The issue is not specific to Starlark, because I can reproduce it with genrule: genrule(
name = "gen",
srcs = ["a dir/a.cc"],
outs = ["out"],
cmd = "echo \"$(location a dir/a.cc)\" && touch $@",
) |
Is that to work around toolchains that can't deal with spaces? IMHO, it seems wrong to quote at that level. I think quoting should be done as close to the Maybe the solution is just to remove that single-quoting from |
Here's a bit of justification for my rationale: I found the bug through the API E.g. if I was dealing with a toolchain that didn't handle spaces, I could always quote the whole |
I agree the sane fix is to remove the quotes. |
Having said that, I'm not sure what to do about
|
IMHO, |
It's been quite a while since I looked into this code, so I don't have any special insight to offer. |
cc @laszlocsomor and @meteorcloudy, as it probably affects Windows users more |
I think this functionality deserves a revamp, however not sure how it looks like. |
+1 to revamp. I've thought about this many times. My strawman proposal is.
As a lower cost solution, as a rule author I never pass files paths on the command line. I spill them into a file through that capability in |
I don't have concrete ideas for the API, but I think that any "v2" should:
|
Hmm, AFAIK when using |
Tested with Bazel 0.18.0 and master as of d4e3ad8.
Small test to reproduce at: https://github.com/ob/bazel-tests/tree/master/spaces
If I run:
I get this output (paths removed and output elided for clarity):
And the build succeeds. However, if I run:
I get this output:
Note that the input_file is double-quoted. The
ctx.expand_location()
function seems to have realized there are spaces, and it single quoted the path. Later on, the action quoted it again.The text was updated successfully, but these errors were encountered: