From e74ac174cbacff8142b5d4acde99ea2a9b4c1ac3 Mon Sep 17 00:00:00 2001 From: Gary Miguel Date: Tue, 30 Aug 2022 14:08:23 -0700 Subject: [PATCH 1/2] Specify path to sed The given commands are not portable between BSD sed and GNU sed. Some users (at least me) have their PATH such that `sed` resolves to a sed that is not default for their OS, and then the given command fails. --- foreign_cc/private/framework/toolchains/freebsd_commands.bzl | 2 +- foreign_cc/private/framework/toolchains/linux_commands.bzl | 2 +- foreign_cc/private/framework/toolchains/macos_commands.bzl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/foreign_cc/private/framework/toolchains/freebsd_commands.bzl b/foreign_cc/private/framework/toolchains/freebsd_commands.bzl index eb560c230..933fd02e0 100644 --- a/foreign_cc/private/framework/toolchains/freebsd_commands.bzl +++ b/foreign_cc/private/framework/toolchains/freebsd_commands.bzl @@ -83,7 +83,7 @@ if [ -d "$1" ]; then for file in ${files[@]+"${files[@]}"}; do local backup=$(mktemp) touch -r "${file}" "${backup}" - sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}" + /usr/bin/sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}" if [[ "$?" -ne "0" ]]; then exit 1 fi diff --git a/foreign_cc/private/framework/toolchains/linux_commands.bzl b/foreign_cc/private/framework/toolchains/linux_commands.bzl index 3cc818e82..dcf77b02e 100644 --- a/foreign_cc/private/framework/toolchains/linux_commands.bzl +++ b/foreign_cc/private/framework/toolchains/linux_commands.bzl @@ -74,7 +74,7 @@ if [ -d "$1" ]; then for file in ${files[@]+"${files[@]}"}; do local backup=$(mktemp) touch -r "${file}" "${backup}" - sed -i 's@'"$2"'@'"$3"'@g' "${file}" + /usr/bin/sed -i 's@'"$2"'@'"$3"'@g' "${file}" if [[ "$?" -ne "0" ]]; then exit 1 fi diff --git a/foreign_cc/private/framework/toolchains/macos_commands.bzl b/foreign_cc/private/framework/toolchains/macos_commands.bzl index d7fc97dbc..aa96fb0bc 100644 --- a/foreign_cc/private/framework/toolchains/macos_commands.bzl +++ b/foreign_cc/private/framework/toolchains/macos_commands.bzl @@ -74,7 +74,7 @@ if [ -d "$1" ]; then for file in ${files[@]+"${files[@]}"}; do local backup=$(mktemp) touch -r "${file}" "${backup}" - sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}" + /usr/bin/sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}" if [[ "$?" -ne "0" ]]; then exit 1 fi From 96b42126e0c6aa66ea0ea70a1a5110610c895a2e Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Fri, 5 May 2023 21:14:22 +0100 Subject: [PATCH 2/2] Restore foreign_cc/private/framework/toolchains/linux_commands.bzl --- foreign_cc/private/framework/toolchains/linux_commands.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foreign_cc/private/framework/toolchains/linux_commands.bzl b/foreign_cc/private/framework/toolchains/linux_commands.bzl index dcf77b02e..3cc818e82 100644 --- a/foreign_cc/private/framework/toolchains/linux_commands.bzl +++ b/foreign_cc/private/framework/toolchains/linux_commands.bzl @@ -74,7 +74,7 @@ if [ -d "$1" ]; then for file in ${files[@]+"${files[@]}"}; do local backup=$(mktemp) touch -r "${file}" "${backup}" - /usr/bin/sed -i 's@'"$2"'@'"$3"'@g' "${file}" + sed -i 's@'"$2"'@'"$3"'@g' "${file}" if [[ "$?" -ne "0" ]]; then exit 1 fi