-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Runfiles: support paths with spaces #4327
Comments
Hmm, this problem also applies to other platforms as well, say macOS, when running
|
@izzyleung thanks for the info! In that case I think P2 or even P3 is safe. I thought this worked on other platforms. |
Update: I haven't looked into fixing this issue and I'm most likely not going to for the next couple months. |
Dropping priority. Spaces aren't well supported on Linux either. It'd be nice if they were fully supported, but this doesn't seem like a critical feature. Demo time: Directory structure:
BUILD file:
bin.sh:
Space aren't supported in data dependencies:
Spaces don't play well with genrule's
|
The bulk of this CL is just plumbing the flag from the configuration into the RunfilesSupplier implementations. The functional changes are in RunfilesTreeUpdater; compare with the preexisting SymlinkTreeStrategy implementation. Additionally, I've fixed some variable and method names to exactly match the flags defined in CoreOptions; the code is less confusing and easier to refactor that way. The motivation behind this change is to investigate the feasibility of defaulting to the in-process implementation and deleting the out-of-process one, which has known issues (see #4327). PiperOrigin-RevId: 558112830 Change-Id: I4c509be665776013ffc2d483694df515d5ab32f2
…und it. For more information: bazelbuild/bazel#4327. PiperOrigin-RevId: 571152898
…paths with spaces for runfiles. More information about the issue can be found in bazelbuild/bazel#4327. PiperOrigin-RevId: 572980749
…paths with spaces for runfiles. More information about the issue can be found in bazelbuild/bazel#4327. PiperOrigin-RevId: 572980749
…paths with spaces for runfiles. More information about the issue can be found in bazelbuild/bazel#4327. PiperOrigin-RevId: 572980749
…paths with spaces for runfiles. More information about the issue can be found in bazelbuild/bazel#4327. PiperOrigin-RevId: 572980749
…paths with spaces for runfiles. More information about the issue can be found in bazelbuild/bazel#4327. PiperOrigin-RevId: 572980749
Is there a way to use a delimiter other then a whitespace for Runfiles manifest entry? e.g. |
It seems like the workaround/fix for this issue is to turn on The only drawback mentioned above was fixed in 7b87ae1 which landed in Bazel 7.0.0. There has been another inquiry on Slack about spaces in the runfiles. I suggest we turn the flag on by default in 7.3.0. As for the manifest file itself, I think #14676 is "almost" there but needs some additional effort to take it over the finish line. If folks are interested in making the runfiles manifest format a bit easier to parse, take a look there. |
@sluongng I would just like to point out this breaking issue with Unsure if its Bazel, or the rules that aren't vibing with this in the way that is expected, but the rule set is popular enough you may want to see it resolved first. I suspect I'm the first-mover to come across this. Here is the ticket: aspect-build/rules_js#1877 |
Cross referencing this issue as the likely root cause of the problem in pypa/setuptools#4605. As previously noted in bazelbuild/rules_python#617 previous workarounds are not bullet proof and there was no guarantee that similar problems would not happen again due the limitation in |
Bazel doesn't handle that gracefully. See bazelbuild/bazel#4327 And `--experimental_inprocess_symlink_creation` doesn't currenly work very well in our repo either. CMK-19117 Change-Id: I2ffeca787241b23af088b9ad19b6ddc59969a664
Adds support for spaces and newlines in source and target paths of runfiles symlinks to `build-runfiles` as well as to the Bash, C++, and Java runfiles libraries (the Python runfiles library has moved out of the repo). If a symlink has spaces or newlines in its source path, it is prefixed with a space in the manifest and spaces, newlines, and backslashes in the source path are escaped with `\s`, `\n`, and `\b` respectively. This scheme has been chosen as it has the following properties: 1. There is no change to the format of manifest lines for entries whose source and target paths don't contain a space. This ensures compatibility with existing runfiles libraries. 2. There is even no change to the format of manifest lines for entries whose target path contains spaces but whose source path does not. These manifests previously failed in `build-runfiles`, but were usable on Windows and supported by the official runfiles libraries. This also ensures that the initialization snippet for the Bash runfiles library doesn't need to change, even when used on Unix with a space in the output base path. 3. The scheme is fully reversible and only depends on the source path, which gives runfiles libraries a choice between reversing the escaping when parsing the manifest (C++, Java) or applying the escaping when searching the manifest (Bash). Fixes bazelbuild#4327 RELNOTES: Bazel now supports all characters in the rlocation and target paths of runfiles and can be run from workspaces with a space in their full path. Closes bazelbuild#23331. PiperOrigin-RevId: 683362776 Change-Id: I1eb79217dcd53cef0089d62a7ba477b1d8f52c21 (cherry picked from commit 7407cef)
Adds support for spaces and newlines in source and target paths of runfiles symlinks to `build-runfiles` as well as to the Bash, C++, and Java runfiles libraries (the Python runfiles library has moved out of the repo). If a symlink has spaces or newlines in its source path, it is prefixed with a space in the manifest and spaces, newlines, and backslashes in the source path are escaped with `\s`, `\n`, and `\b` respectively. This scheme has been chosen as it has the following properties: 1. There is no change to the format of manifest lines for entries whose source and target paths don't contain a space. This ensures compatibility with existing runfiles libraries. 2. There is even no change to the format of manifest lines for entries whose target path contains spaces but whose source path does not. These manifests previously failed in `build-runfiles`, but were usable on Windows and supported by the official runfiles libraries. This also ensures that the initialization snippet for the Bash runfiles library doesn't need to change, even when used on Unix with a space in the output base path. 3. The scheme is fully reversible and only depends on the source path, which gives runfiles libraries a choice between reversing the escaping when parsing the manifest (C++, Java) or applying the escaping when searching the manifest (Bash). Fixes bazelbuild#4327 RELNOTES: Bazel now supports all characters in the rlocation and target paths of runfiles and can be run from workspaces with a space in their full path. Closes bazelbuild#23331. PiperOrigin-RevId: 683362776 Change-Id: I1eb79217dcd53cef0089d62a7ba477b1d8f52c21 (cherry picked from commit 7407cef)
(contains the refactor in f311efc to reduce merge conflicts) Adds support for spaces and newlines in source and target paths of runfiles symlinks to `build-runfiles` as well as to the Bash, C++, and Java runfiles libraries (the Python runfiles library has moved out of the repo). If a symlink has spaces or newlines in its source path, it is prefixed with a space in the manifest and spaces, newlines, and backslashes in the source path are escaped with `\s`, `\n`, and `\b` respectively. This scheme has been chosen as it has the following properties: 1. There is no change to the format of manifest lines for entries whose source and target paths don't contain a space. This ensures compatibility with existing runfiles libraries. 2. There is even no change to the format of manifest lines for entries whose target path contains spaces but whose source path does not. These manifests previously failed in `build-runfiles`, but were usable on Windows and supported by the official runfiles libraries. This also ensures that the initialization snippet for the Bash runfiles library doesn't need to change, even when used on Unix with a space in the output base path. 3. The scheme is fully reversible and only depends on the source path, which gives runfiles libraries a choice between reversing the escaping when parsing the manifest (C++, Java) or applying the escaping when searching the manifest (Bash). Fixes #4327 RELNOTES: Bazel now supports all characters in the rlocation and target paths of runfiles and can be run from workspaces with a space in their full path. Closes #23331. PiperOrigin-RevId: 683362776 Change-Id: I1eb79217dcd53cef0089d62a7ba477b1d8f52c21 (cherry picked from commits 7407cef and f311efc) Closes #23715 --------- Co-authored-by: Googler <[email protected]>
A fix for this issue has been included in Bazel 7.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. |
Update: this bug no longer claims to be Windows-specific, see #4327 (comment)
Fix this TODO:
bazel/src/main/java/com/google/devtools/build/lib/windows/runfiles/WindowsRunfiles.java
Lines 54 to 55 in 7b423cc
The text was updated successfully, but these errors were encountered: