Skip to content

Commit 497b7e4

Browse files
fmeumcopybara-github
authored andcommitted
Fix Bash runfiles_current_repository with RBE
During remote execution, absolute paths may not contain `execroot` segments. Work towards bazelbuild#16933 Closes bazelbuild#16946. PiperOrigin-RevId: 493876135 Change-Id: I5ceb8c6edbe0e58aae2066efe1230e622eabf9bf
1 parent f82fc5b commit 497b7e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/bash/runfiles/runfiles.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function runfiles_current_repository() {
260260
# The only shell script that is not executed from the runfiles directory (if it is populated)
261261
# is the sh_binary entrypoint. Parse its path under the execroot, using the last match to
262262
# allow for nested execroots (e.g. in Bazel integration tests).
263-
local -r repository=$(echo "$normalized_caller_path" | __runfiles_maybe_grep -E -o '/execroot/[^/]+/bazel-out/[^/]+/bin/external/[^/]+/' | tail -1 | rev | cut -d / -f 2 | rev)
263+
local -r repository=$(echo "$normalized_caller_path" | __runfiles_maybe_grep -E -o '/bazel-out/[^/]+/bin/external/[^/]+/' | tail -1 | rev | cut -d / -f 2 | rev)
264264
if [[ -n "$repository" ]]; then
265265
if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
266266
echo >&2 "INFO[runfiles.bash]: runfiles_current_repository($idx): ($normalized_caller_path) lies in repository ($repository)"

0 commit comments

Comments
 (0)