From: Paul Eggert Date: Tue, 2 Jan 2024 00:51:51 +0000 (-0800) Subject: update-copyright-tests: immunize against self X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=88be141d492e5b07ef1052e186fcf3bec9601c2c;p=gnulib.git update-copyright-tests: immunize against self Problem reported by Bernhard Voelker in: https://lists.gnu.org/r/bug-gnulib/2024-01/msg00003.html * tests/test-update-copyright.sh (ight): New var. Use it in tests, to prevent update-copyright from messing with the test data. --- diff --git a/ChangeLog b/ChangeLog index af3cf23a6c..fc728584f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-01-01 Paul Eggert + + update-copyright-tests: immunize against self + Problem reported by Bernhard Voelker in: + https://lists.gnu.org/r/bug-gnulib/2024-01/msg00003.html + * tests/test-update-copyright.sh (ight): New var. + Use it in tests, to prevent update-copyright from + messing with the test data. + 2023-12-29 Paul Eggert tests: don’t skip if LONG_MAX < pid diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index ff7a6b2770..b2a7f2df8a 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -76,46 +76,53 @@ perl -e 'require 5.8.0' || { UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72 export UPDATE_COPYRIGHT_MAX_LINE_LENGTH +# This assignment to 'ight' is so that data can contain strings +# like "Copy$ight 2024 Free Software Foundation, Inc." without being +# mistakenly updated by "cd .. && make update-copyright". +ight=right + ## ----------------------------- ## ## Examples from documentation. ## ## ----------------------------- ## TMP=$TMP_BASE-ex cat > $TMP-1 < $TMP-2 < $TMP-3 < $TMP-4 < $TMP-5 < $TMP-6 < $TMP-7 < $TMP-8 < $TMP.1 < $TMP.2 < $TMP.3 < $TMP.4 < $TMP < $TMP < $TMP < $TMP < $TMP < $TMP < $TMP <<\EOF -Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@ +tr @ '\015' > $TMP < $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare /dev/null $TMP-stderr || exit 1 -tr @ '\015' > $TMP-exp <<\EOF -Rem Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@ +tr @ '\015' > $TMP-exp < $TMP < $TMP.star < $TMP.space < $TMP.single-line < $TMP.single-line-wrapped < $TMP.extra-text-star < $TMP.extra-text-space < $TMP.two-digit-final-is-substr-of-first < $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare /dev/null $TMP-stderr || exit 1 compare - $TMP.star <