summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-10-15 18:53:55 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-10-15 18:54:49 -0700
commit074cbe590bb5f9d4be7334162e0803264bf5717d (patch)
tree0c95c04744c2321bcc0108f67c9eaa6c784681de /tests
parent08b103ff4da9be30ea90e5a04b4ccea694f18ed3 (diff)
downloaddiffutils-074cbe590bb5f9d4be7334162e0803264bf5717d.tar.gz
diff: fix timezone bug on Solaris
Problem reported by Vladimir Marek (bug#51228). * NEWS: Mention this. * src/context.c (print_context_label): Pass localtz to nstrftime, instead of always passing 0. * src/diff.c (main) [!HAVE_TM_GMTOFF]: Initialize localtz if time_format uses %z. * src/diff.h (localtz): New decl. * tests/Makefile.am (TESTS): Add timezone. * tests/timezone: New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/timezone14
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 83a7c9d..d98df82 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,7 @@ TESTS = \
strcoll-0-names \
filename-quoting \
strip-trailing-cr \
+ timezone \
colors
XFAIL_TESTS = large-subopt
diff --git a/tests/timezone b/tests/timezone
new file mode 100755
index 0000000..52b9e18
--- /dev/null
+++ b/tests/timezone
@@ -0,0 +1,14 @@
+#!/bin/sh
+# In diff 3.4 through 3.8, this would output the wrong timezone on Solaris.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+fail=0
+
+echo a >a || fail=1
+case $(LC_ALL=C TZ=EST5 diff -u /dev/null a) in
+ *' -0500'*) ;;
+ *) fail=1 ;;
+esac
+
+Exit $fail