summaryrefslogtreecommitdiff
path: root/HACKING
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2023-02-13 11:39:11 -0600
committerG. Branden Robinson <g.branden.robinson@gmail.com>2023-02-13 12:06:09 -0600
commita47e8985205d6c564b66e0d780b5893dabc6c84d (patch)
tree66e1cd309debbe1895813ac3af83f0abc1986358 /HACKING
parent57e13c40ea472bc3276d0d630d2745e5e6a26744 (diff)
downloadgroff-git-a47e8985205d6c564b66e0d780b5893dabc6c84d.tar.gz
[man]: Port a test to work with macOS sed.
* tmac/tests/an_TS-adds-no-vertical-space.sh: Put semicolons between commands and closing braces in sed script. Separate command stream into multiple '-e' expressions, breaking them after branch and label commands. Resolves test failure observed on macOS. * HACKING: Document the above problems. * ANNOUNCE: Drop notice of failing test case, now resolved.
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING20
1 files changed, 20 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index 58893fbc9..9e1d8c07d 100644
--- a/HACKING
+++ b/HACKING
@@ -85,3 +85,23 @@ Here are some portability notes on writing automated tests.
grep -Eqx '0000000 +A +\\b +B +\\b +C D +\\n'
might need to be weakened to the following on macOS.
grep -Eqx '0000000 +A +\\b +B +\\b +C D +\\n *'
+
+* macOS sed requires semicolons after commands even if they are followed
+ immediately by a closing brace.
+
+ Rewrite
+ sed -n '/Foo\./{n;s/^$/FAILURE/;p}'
+ as follows.
+ sed -n '/Foo\./{n;s/^$/FAILURE/;p;}'
+
+* POSIX doesn't say that sed has to accept semicolons as command
+ separators after label (':') and branch ('t') commands, so it doesn't.
+ GNU sed does.
+
+ So rewrite tidy, compact sed scripts like this:
+ sed -n '/Foo\./{n;s/^$/FAILURE/;tA;s/.*/SUCCESS/;:A;p}'
+ as this more cumbersome alternative.
+ sed -n \
+ -e '/Foo\./{n;s/^$/FAILURE/;tA;' \
+ -e 's/.*/SUCCESS/;:A;' \
+ -e 'p;}')