From 20a2f62300d5eaae6f48aa2ad62a01f631c49e78 Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 10 Nov 2026 12:54:55 -0700 Subject: [PATCH] report: keep four-part versions after v or == The IPv4 rule replaced not1mm's new version in "v26.11.10.1" and "not1mm==26.11.10.1" with (report CD-GB29BZ), because only a digit or dot before an address kept it. Also keep ones after v, V or ==; an address after a single =, as in addr=192.168.1.20, is still replaced. Co-Authored-By: Claude Opus 5.5 --- report | 8 +++++--- tests/report.bats | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/report b/report index cf29585..b180cb1 100755 --- a/report +++ b/report @@ -55,7 +55,9 @@ regex_escape() { # terminal codes or progress redraws, and with personal details replaced. # LC_ALL=C so the ranges mean bytes, whatever the locale. IPv4 addresses are # replaced twice because a match takes the character after an address, which -# can be the one before the next; dotted versions such as 1.0.4.1.3 are kept. +# can be the one before the next; dotted versions such as 1.0.4.1.3 are kept, +# and so are four-part ones after v or == (v26.11.10.1, not1mm==26.11.10.1). +# A single = doesn't count, so addr=192.168.1.20 is still replaced. redact() { local home user host home="$(regex_escape "$HOME")" @@ -68,8 +70,8 @@ redact() { -e "s#${home}([/[:space:]'\":]|\$)#~\\1#g" \ -e 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}//g' \ -e 's/[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.ts\.net//g' \ - -e 's/(^|[^0-9.])([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1\3/g' \ - -e 's/(^|[^0-9.])([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1\3/g' \ + -e 's/(^=?|[^0-9.vV=]|[^=]=)([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1\3/g' \ + -e 's/(^=?|[^0-9.vV=]|[^=]=)([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1\3/g' \ -e "s/(^|[^A-Za-z0-9_-])${user}([^A-Za-z0-9_-]|\$)/\\1\\2/g" \ -e "s/(^|[^A-Za-z0-9_-])${host}([^A-Za-z0-9_-]|\$)/\\1\\2/g" \ "$1" diff --git a/tests/report.bats b/tests/report.bats index f59ec7a..ddb7fed 100644 --- a/tests/report.bats +++ b/tests/report.bats @@ -54,6 +54,8 @@ field() { "ardop 1.0.4.1.3 is up to date. gridtracker2 2.261108.4-1, python 3.14" \ "ssh alice@lab from 192.168.1.20; mail david@federated.computer" \ "lab.tail1234.ts.net 100.101.102.103 127.0.0.1" \ + "Updated not1mm v26.11.6 -> v26.11.10.1; + not1mm==26.11.10.1; V1.2.3.4" \ + "addr=192.168.1.20 =10.0.0.1 [10.0.0.2] (10.0.0.3)" \ "alicesmith and labrador stay" > "$LOG" run bash "$REPO/report" --view "$LOG" @@ -64,6 +66,8 @@ field() { "ardop 1.0.4.1.3 is up to date. gridtracker2 2.261108.4-1, python 3.14" \ "ssh @ from ; mail " \ " " \ + "Updated not1mm v26.11.6 -> v26.11.10.1; + not1mm==26.11.10.1; V1.2.3.4" \ + "addr= = [] ()" \ "alicesmith and labrador stay")" ] ! grep -q curl "$STUB_LOG" }