From 67880e35cf0929df1105e278387ee80c7ebfc6d4 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Thu, 26 Nov 2020 13:58:08 +0000 Subject: [PATCH] tests/builtins.sh: fix false fail when TZ is GMT (re: eaaa0de7) GMT and UTC have identical time but are used in different contexts. When the system time zone is set to GMT (e.g. in the UK at winter time), the 'printf %T' test could fail as it correctly uses GMT whereas the test expects UTC. src/cmd/ksh93/tests/builtins.sh: - Fix possible false negative in 'printf %T\\n now' test by replacing GMT with UTC in both 'date' output and 'printf %T' output, instead of only the former. --- src/cmd/ksh93/tests/builtins.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/ksh93/tests/builtins.sh b/src/cmd/ksh93/tests/builtins.sh index 680548e14..a482789b6 100755 --- a/src/cmd/ksh93/tests/builtins.sh +++ b/src/cmd/ksh93/tests/builtins.sh @@ -349,8 +349,8 @@ fi # ====== # we won't get hit by the one second boundary twice, right? expect= actual= -{ expect=$(LC_ALL=C date | sed 's/ GMT / UTC /') && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } || -{ expect=$(LC_ALL=C date | sed 's/ GMT / UTC /') && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } || +{ expect=$(LC_ALL=C date) && actual=$(LC_ALL=C printf '%T\n' now) && [[ ${actual/ GMT / UTC } == "${expect/ GMT / UTC }" ]]; } || +{ expect=$(LC_ALL=C date) && actual=$(LC_ALL=C printf '%T\n' now) && [[ ${actual/ GMT / UTC } == "${expect/ GMT / UTC }" ]]; } || err_exit 'printf "%T" now' "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" behead() {