commit 64af9ac04decbf54ce6b650fd2f6a28f235b7332 from: Christian Weisgerber date: Sat Jul 26 15:36:51 2025 UTC regress: replace "sed -i" with ed(1) for portable in-place editing "sed -i" is fundamentally unportable. GNU and OpenBSD sed(1) treat the extension for the backup file as an optional argument and use "sed -i" for no backup file. FreeBSD sed(1) treats the extension as an obligatory argument and uses "sed -i ''" for no backup file. There is no single syntax that works for both. commit - d7677e54e3e81837bb9206cdd2d4a49c7d108246 commit + 64af9ac04decbf54ce6b650fd2f6a28f235b7332 blob - 80353942463567fdee376f1cbfd018b1513b4539 blob + ee4ebfecae595a8fb6d759b45ba4df154fd4aeeb --- regress/cmdline/revert.sh +++ regress/cmdline/revert.sh @@ -1884,9 +1884,12 @@ test_revert_staged_file() { > /dev/null) local commit_id=`git_show_head $testroot/repo` - sed -i -e 's/line 0/line 0a/' $testroot/wt/epsilon/zeta - sed -i -e 's/line 4/line 4a/' $testroot/wt/epsilon/zeta - sed -i -e 's/line 6/line 6a/' $testroot/wt/epsilon/zeta + ed -s $testroot/wt/epsilon/zeta <<-\EOF + ,s/line 0/line 0a/ + ,s/line 4/line 4a/ + ,s/line 6/line 6a/ + w + EOF # stage line 0 and line 6 printf "y\n" > $testroot/patchscript @@ -1991,9 +1994,12 @@ test_revert_partially_staged_file() { > /dev/null) local commit_id=`git_show_head $testroot/repo` - sed -i -e 's/line 0/line 0a/' $testroot/wt/epsilon/zeta - sed -i -e 's/line 4/line 4a/' $testroot/wt/epsilon/zeta - sed -i -e 's/line 6/line 6a/' $testroot/wt/epsilon/zeta + ed -s $testroot/wt/epsilon/zeta <<-\EOF + ,s/line 0/line 0a/ + ,s/line 4/line 4a/ + ,s/line 6/line 6a/ + w + EOF # stage line 0 and line 6 printf "y\n" > $testroot/patchscript