From 33a0d5a93dbebfc80791d4dde0c18e821ef054b4 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Wed, 7 Dec 2022 12:22:26 +0100 Subject: [PATCH] Fix Bash `runfiles_current_repository` with RBE During remote execution, absolute paths may not contain `execroot` segments. --- tools/bash/runfiles/runfiles.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bash/runfiles/runfiles.bash b/tools/bash/runfiles/runfiles.bash index 72f85d92563a00..29706dfce6a704 100644 --- a/tools/bash/runfiles/runfiles.bash +++ b/tools/bash/runfiles/runfiles.bash @@ -260,7 +260,7 @@ function runfiles_current_repository() { # The only shell script that is not executed from the runfiles directory (if it is populated) # is the sh_binary entrypoint. Parse its path under the execroot, using the last match to # allow for nested execroots (e.g. in Bazel integration tests). - 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) + local -r repository=$(echo "$normalized_caller_path" | __runfiles_maybe_grep -E -o '/bazel-out/[^/]+/bin/external/[^/]+/' | tail -1 | rev | cut -d / -f 2 | rev) if [[ -n "$repository" ]]; then if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then echo >&2 "INFO[runfiles.bash]: runfiles_current_repository($idx): ($normalized_caller_path) lies in repository ($repository)"