Skip to content
Snippets Groups Projects
Unverified Commit 1a16e006 authored by Fabian Meumertzheim's avatar Fabian Meumertzheim Committed by GitHub
Browse files

[7.4.0] Allow all characters in runfile source and target paths (#23912)

(contains the refactor in f311efc5 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 https://github.com/bazelbuild/bazel/issues/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 https://github.com/bazelbuild/bazel/pull/23331.

PiperOrigin-RevId: 683362776
Change-Id: I1eb79217dcd53cef0089d62a7ba477b1d8f52c21

(cherry picked from commits
https://github.com/bazelbuild/bazel/commit/7407cef3837b4fe14e48e1a925f9b886c0cc945d
and f311efc5

)

Closes #23715

---------

Co-authored-by: default avatarGoogler <jhorvitz@google.com>
parent c438ae68
No related merge requests found
Showing
with 754 additions and 120 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment