From 717a01a712b427130c6ebb23940e65addb6ed65a Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 23 Oct 2023 16:16:34 -0400 Subject: [PATCH] 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. Change-Id: Ifd2cd5b27df05e3301e527ef1d8e718b434d2236 Signed-off-by: Michael Jeanson Reviewed-on: https://review.lttng.org/c/babeltrace/+/11132 Reviewed-by: Simon Marchi Reviewed-by: Philippe Proulx --- tests/utils/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index c2ea3341..8bf9df89 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -153,7 +153,7 @@ fi # Remove CR characters in file "$1". bt_remove_cr() { - "$BT_TESTS_SED_BIN" -i 's/\r//g' "$1" + "$BT_TESTS_SED_BIN" -i'' -e 's/\r//g' "$1" } # Run the Babeltrace CLI, redirecting stdout and stderr to specified files. -- 2.34.1