chiark / gitweb /
test suite: debchange: Work around faketime TZ bug
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Aug 2018 16:36:52 +0000 (17:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Aug 2018 00:20:44 +0000 (01:20 +0100)
faketime's CLI does not permit correct unparsing of times in arbitrary
timezones.  So we must save and restore TZ.

See #907264.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/tstunt/debchange

index de324e9..e5ec4d8 100755 (executable)
@@ -4,6 +4,13 @@ set -e
 spec=$(date --rfc-3339=seconds -d @"${GIT_AUTHOR_DATE% *}")
 spec=${spec%+*}
 
+# The nonsense with TZ is to work around #907264
+tz_set=${TZ+set}
+if ! test "$tz_set"; then tz_undef=-u; fi
+
 set -x
+
+env TZ=UTC \
 faketime -f "$spec" \
+env $tz_undef TZ${tz_set:+=}"$TZ" \
 "${DGIT_TEST_REAL_DEBCHANGE-debchange}" "$@"