Skip to content

Commit

Permalink
Use a sed delimiter that is unlikely to appear in the input (#1184)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauf authored Mar 22, 2024
1 parent 86936d7 commit 99d018f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if [ -d "$1" ]; then
for file in ${files[@]+"${files[@]}"}; do
local backup=$(mktemp)
touch -r "${file}" "${backup}"
/usr/bin/sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}"
/usr/bin/sed -i '' -e 's'$'\001'"$2"$'\001'"$3"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion foreign_cc/private/framework/toolchains/linux_commands.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
sed -i 's'$'\001'"$2"$'\001'"$3"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion foreign_cc/private/framework/toolchains/macos_commands.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 '' -e 's@'"$2"'@'"$3"'@g' "${file}"
/usr/bin/sed -i '' -e 's'$'\001'"$2"$'\001'"$3"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if [ -d "$1" ]; then
for file in ${files[@]+"${files[@]}"}; do
local backup=$(mktemp)
touch -r "${file}" "${backup}"
sed -i 's@'"${argv2}"'@'"${argv3}"'@g' "${file}"
sed -i 's'$'\001'"${argv2}"$'\001'"${argv3}"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi
Expand Down

0 comments on commit 99d018f

Please sign in to comment.