From 8e47494dffd41b5f02a8969bb2daaf894ca4ac3f Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Tue, 30 Mar 2021 16:04:34 -0700 Subject: [PATCH] Remove newline-eof canonification attempt in diff-remove-timestamps On Alpine (BusyBox `sed`), the previous `sed -e '$a\'` invocation always added a newline, breaking most every diff. There doesn't seem to be a need to attempt normalizing EOF newlines at the moment and doing it that way doesn't seem to be portable anyway. If canonifiers need to be portable, `sed` should be treated as a text-processing tool and POSIX definition of text-file is zero or more newline-terminated character-sequences, so if canonification of Baselines via `sed` is required, those Baselines should always end with a newline to be considered text files. I.e. that's not the job of this canonifier, and changing it also doesn't necessarily generalize since it could be considered coincidental that diff-remove-timestamps in particular is the default canonifier that's commonly used while there's still others that also make use of `sed`. --- testing/scripts/diff-remove-timestamps | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testing/scripts/diff-remove-timestamps b/testing/scripts/diff-remove-timestamps index 5c5956a0ed..0bcc458739 100755 --- a/testing/scripts/diff-remove-timestamps +++ b/testing/scripts/diff-remove-timestamps @@ -9,6 +9,4 @@ else sed="sed -E" fi -# $a\ adds a newline to the end of the file if it does not exist. -# This unifies the behavior of BSD and GNU sed -$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' -e '$a\' +$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'