Skip to content

Commit 7e38c84

Browse files
mjeansoneepp
authored andcommitted
fix: tests: use a portable invocation of 'sed -i'
The GNU and BSD sed implementations slightly differ in the handling of an argument to the '-i' switch to use as a suffix to a backup file. BSD sed requires an argument while it's optional for GNU sed, if present it must be placed directly after the switch with no space. To make both implementations work properly and not create a backup file, a zero length argument must be placed directly after the switch with no space. Signed-off-by: Michael Jeanson <[email protected]> Signed-off-by: Philippe Proulx <[email protected]> Change-Id: Ie1584fbdaf9d8752190f10288b2a1a89e3a43ad1
1 parent 49e2fae commit 7e38c84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/utils/utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ BT_CTF_TRACES_PATH="${BT_TESTS_DATADIR}/ctf-traces"
137137
# Remove CR characters in file "$1".
138138

139139
bt_remove_cr() {
140-
"$BT_TESTS_SED_BIN" -i 's/\r//g' "$1"
140+
"$BT_TESTS_SED_BIN" -i'' -e 's/\r//g' "$1"
141141
}
142142

143143
# Run the Babeltrace CLI, redirecting stdout and stderr to specified files.

0 commit comments

Comments
 (0)