Merge remote-tracking branch 'origin/topic/awelzel/sed-E-everywhere'

* origin/topic/awelzel/sed-E-everywhere:
  testing/scripts: Use sed -E everywhere
This commit is contained in:
Arne Welzel 2024-01-24 23:04:38 +01:00
commit a16179eae7
11 changed files with 24 additions and 75 deletions

View file

@ -1,3 +1,12 @@
6.2.0-dev.463 | 2024-01-24 23:04:38 +0100
* testing/scripts: Use sed -E everywhere (Arne Welzel, Corelight)
I'm always a bit worried to use sed -E anywhere, because the canonifiers
give the impression it won't work everywhere consistently. My manpage says
sed -E should be preferred for portability, so lets remove the
sed -r / sed -E differentiation assuming it's just a thing from the past.
6.2.0-dev.461 | 2024-01-24 23:04:12 +0100
* HTTP: Coverity std::move suggestion (Arne Welzel, Corelight)

View file

@ -1 +1 @@
6.2.0-dev.461
6.2.0-dev.463

View file

@ -5,13 +5,6 @@
# - The version number, which becomes "x.y.z"
# - Spacing in the report, which we normalize to single spaces
# Get us "modern" regexps with sed.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed -e 's/[0-9]+ skipped/XX skipped/g' |
$sed -e 's/"[0-9]+\.[0-9]+\.[0-9]+"/"x.y.z"/g' |
$sed -e 's/ {2,}/ /g'
sed -E -e 's/[0-9]+ skipped/XX skipped/g' |
sed -E -e 's/"[0-9]+\.[0-9]+\.[0-9]+"/"x.y.z"/g' |
sed -E -e 's/ {2,}/ /g'

View file

@ -2,12 +2,6 @@
#
# Replace absolute paths with the basename.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed 's#/+#/#g' |
$sed 's#[^( ]*testing_btest#<___>testing_btest#' |
$sed 's#([a-zA-Z]:)?/([^ :/]{1,}/){1,}([^ :/]{1,})#<...>/\3#g'
sed -E 's#/+#/#g' |
sed -E 's#[^( ]*testing_btest#<___>testing_btest#' |
sed -E 's#([a-zA-Z]:)?/([^ :/]{1,}/){1,}([^ :/]{1,})#<...>/\3#g'

View file

@ -2,11 +2,4 @@
#
# Replace timestamps in the #start/end markers in logs.
# Get us "modern" regexps with sed.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g'
sed -E 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g'

View file

@ -3,10 +3,4 @@
# Replace absolute paths in Spicy error message with the basename. This is more
# restrictive than diff-remove-abspath to avoid catching other stuff.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed 's#/([^:/]{1,}/){1,}([^:/]{1,}\.spicy[:,])#<...>/\2#g'
sed -E 's#/([^:/]{1,}/){1,}([^:/]{1,}\.spicy[:,])#<...>/\2#g'

View file

@ -2,11 +2,4 @@
#
# Replace anything which looks like timestamps with XXXs (including the #start/end markers in logs).
# Get us "modern" regexps with sed.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed -e 's/(^|[^0-9])([0-9]{9,10}\.[0-9]{1,8})/\1XXXXXXXXXX.XXXXXX/g' -e 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g'
sed -E -e 's/(^|[^0-9])([0-9]{9,10}\.[0-9]{1,8})/\1XXXXXXXXXX.XXXXXX/g' -e 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g'

View file

@ -2,13 +2,6 @@
#
# Remove unstable pieces in Zeek logs.
# Get us "modern" regexps with sed.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
${sed} 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g' |
sed -E 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g' |
$(dirname $0)/diff-remove-timestamps |
$(dirname $0)/diff-remove-abspath

View file

@ -2,14 +2,7 @@
#
# Remove unstable pieces in Zeek logs.
# Get us "modern" regexps with sed.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
${sed} 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g' |
sed -E 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g' |
$(dirname $0)/diff-sort |
$(dirname $0)/diff-remove-timestamps |
$(dirname $0)/diff-remove-abspath

View file

@ -2,11 +2,5 @@
#
# Replace absolute paths with the basename.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed 's#/+#/#g' |
$sed 's#/([^ :/]{1,}/){1,}([^ :/]{1,})#<...>/\2#g'
sed -E 's#/+#/#g' |
sed -E 's#/([^ :/]{1,}/){1,}([^ :/]{1,})#<...>/\2#g'

View file

@ -2,11 +2,4 @@
#
# Replace anything which looks like timestamps with XXXs (including the #start/end markers in logs).
# Get us "modern" regexps with sed.
if [ $(uname) == "Linux" ]; then
sed="sed -r"
else
sed="sed -E"
fi
$sed -e 's/(^|[^0-9])([0-9]{9,10}\.[0-9]{1,8})/\1XXXXXXXXXX.XXXXXX/g' -e 's/^ *#(open|close).(19|20)..-..-..-..-..-../#\1 XXXX-XX-XX-XX-XX-XX/g'
sed -E 's/(^|[^0-9])([0-9]{9,10}\.[0-9]{1,8})/\1XXXXXXXXXX.XXXXXX/g' -e 's/^ *#(open|close).(19|20)..-..-..-..-..-../#\1 XXXX-XX-XX-XX-XX-XX/g'