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 <ip> (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 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 12:54:55 -07:00
co-authored by Claude Opus 5.5
parent 1507ae925e
commit 20a2f62300
2 changed files with 9 additions and 3 deletions
+5 -3
View File
@@ -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,}/<email>/g' \
-e 's/[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.ts\.net/<tailscale-name>/g' \
-e 's/(^|[^0-9.])([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
-e 's/(^|[^0-9.])([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
-e 's/(^=?|[^0-9.vV=]|[^=]=)([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
-e 's/(^=?|[^0-9.vV=]|[^=]=)([0-9]{1,3}\.){3}[0-9]{1,3}([^0-9.]|$)/\1<ip>\3/g' \
-e "s/(^|[^A-Za-z0-9_-])${user}([^A-Za-z0-9_-]|\$)/\\1<user>\\2/g" \
-e "s/(^|[^A-Za-z0-9_-])${host}([^A-Za-z0-9_-]|\$)/\\1<host>\\2/g" \
"$1"
+4
View File
@@ -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 <user>@<host> from <ip>; mail <email>" \
"<tailscale-name> <ip> <ip>" \
"Updated not1mm v26.11.6 -> v26.11.10.1; + not1mm==26.11.10.1; V1.2.3.4" \
"addr=<ip> =<ip> [<ip>] (<ip>)" \
"alicesmith and labrador stay")" ]
! grep -q curl "$STUB_LOG"
}