Skip to content
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

[7.4.0] Allow spaces in runfile source and target paths #23715

Closed
bazel-io opened this issue Sep 23, 2024 · 3 comments
Closed

[7.4.0] Allow spaces in runfile source and target paths #23715

bazel-io opened this issue Sep 23, 2024 · 3 comments

Comments

@bazel-io
Copy link
Member

Forked from #23331

@bazel-io bazel-io added this to the 7.4.0 release blockers milestone Sep 23, 2024
@bazel-io
Copy link
Member Author

bazel-io commented Oct 8, 2024

Cherry-pick was attempted but there were merge conflicts in the following file(s). Please resolve manually.

MODULE.bazel.lock
src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java
src/test/java/com/google/devtools/build/lib/analysis/SourceManifestActionTest.java
src/test/shell/integration/runfiles_test.sh

cc: @bazelbuild/triage

@iancha1992
Copy link
Member

Cherry-pick was attempted but there were merge conflicts in the following file(s). Please resolve manually.

MODULE.bazel.lock src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java src/test/java/com/google/devtools/build/lib/analysis/SourceManifestActionTest.java src/test/shell/integration/runfiles_test.sh

cc: @bazelbuild/triage

cc: @lberki @fmeum @meteorcloudy

@fmeum
Copy link
Collaborator

fmeum commented Oct 9, 2024

#23912

github-merge-queue bot pushed a commit that referenced this issue Oct 9, 2024
(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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants