From abe01179de75aaee2d12a99378f288af1fc73fc7 Mon Sep 17 00:00:00 2001 From: Tobias Kaupat Date: Sun, 18 Oct 2026 10:38:48 +0200 Subject: [PATCH] test: avoid GNU-only sed -i in the sabotage self test Co-Authored-By: Claude Sonnet 5.5 --- test/run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/run.sh b/test/run.sh index 82dca37..07d5365 100644 --- a/test/run.sh +++ b/test/run.sh @@ -85,7 +85,9 @@ if [ "$SABOTAGE" -eq 1 ]; then trap 'rm -rf "$tmp"; docker rmi -f restic-backup-docker:sabotage >/dev/null 2>&1 || true' EXIT tar -c -C "$ROOT_DIR" --exclude=.git --exclude=.intent . | tar -x -C "$tmp" # Silently turn the backup into a no-op, the nastiest kind of regression. - sed -i 's|^restic backup |true |' "$tmp/backup.sh" + # No `sed -i`: its argument differs between GNU and BSD (macOS) sed. + sed 's|^restic backup |true |' "$tmp/backup.sh" > "$tmp/backup.sh.new" \ + && mv "$tmp/backup.sh.new" "$tmp/backup.sh" if ! grep -q '^true ' "$tmp/backup.sh"; then echo "sabotage patch did not apply, backup.sh changed shape" >&2 exit 2