Skip to content

Commit 9ae9d1d

Browse files
nikhilkaligecopybara-github
authored andcommitted
Add the runfiles.bash.oss file for []
Closes #20885. PiperOrigin-RevId: 599442183 Change-Id: I4d546ebebeb9007632e51f1ec000bb2332f19cb6
1 parent f310a44 commit 9ae9d1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/bash/runfiles/runfiles.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function runfiles_current_repository() {
253253
echo >&2 "ERROR[runfiles.bash]: runfiles_current_repository($idx): ($normalized_caller_path) is not the target of an entry in the runfiles manifest ($RUNFILES_MANIFEST_FILE)"
254254
fi
255255
# The binary may also be run directly from bazel-bin or bazel-out.
256-
local -r repository=$(echo "$normalized_caller_path" | __runfiles_maybe_grep -E -o '(^|/)(bazel-out/[^/]+/bin|bazel-bin)/external/[^/]+/' | tail -1 | rev | cut -d / -f 2 | rev)
256+
local -r repository=$(echo "$normalized_caller_path" | __runfiles_maybe_grep -E -o '(^|/)(bazel-out/[^/]+/bin|bazel-bin)/external/[^/]+/' | tail -1 | awk -F/ '{print $(NF-1)}')
257257
if [[ -n "$repository" ]]; then
258258
if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
259259
echo >&2 "INFO[runfiles.bash]: runfiles_current_repository($idx): ($normalized_caller_path) lies in repository ($repository) (parsed exec path)"
@@ -295,7 +295,7 @@ function runfiles_current_repository() {
295295
# is the sh_binary entrypoint. Parse its path under the execroot, using the last match to
296296
# allow for nested execroots (e.g. in Bazel integration tests). The binary may also be run
297297
# directly from bazel-bin.
298-
local -r repository=$(echo "$normalized_caller_path" | __runfiles_maybe_grep -E -o '(^|/)(bazel-out/[^/]+/bin|bazel-bin)/external/[^/]+/' | tail -1 | rev | cut -d / -f 2 | rev)
298+
local -r repository=$(echo "$normalized_caller_path" | __runfiles_maybe_grep -E -o '(^|/)(bazel-out/[^/]+/bin|bazel-bin)/external/[^/]+/' | tail -1 | awk -F/ '{print $(NF-1)}')
299299
if [[ -n "$repository" ]]; then
300300
if [[ "${RUNFILES_LIB_DEBUG:-}" == 1 ]]; then
301301
echo >&2 "INFO[runfiles.bash]: runfiles_current_repository($idx): ($normalized_caller_path) lies in repository ($repository) (parsed exec path)"

0 commit comments

Comments
 (0)