diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-03-17 10:35:18 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-03-17 10:36:33 -0700 |
commit | df88fce71651afb2c3456967a142db0ae4bf9906 (patch) | |
tree | aa18160fb6d2ef669fcfc04e914da9d10b649287 /tests/fmt | |
parent | c18b3699e1b8c4ad2739761f2b9c306ff2303322 (diff) | |
download | coreutils-df88fce71651afb2c3456967a142db0ae4bf9906.tar.xz |
date ls pr: fix time zone abbrs on SysV platforms
The problematic code computed a struct tm in one time zone, and
then printed it or converted it to a string in another. To be
portable the same time zone needs to be used for both operations.
On GNU platforms this is not an issue, but incorrect output can be
generated on System V style platforms like AIX where time zone
abbreviations are available only in the 'tzname' global variable.
Problem reported by Assaf Gordon in: http://bugs.gnu.org/23035
* NEWS: Document the bug.
* src/date.c (show_date):
* src/ls.c (long_time_expected_width, print_long_format):
* src/pr.c (init_header):
* src/stat.c (human_time): Use localtime_rz instead of localtime,
so that the time zone information is consistent for both localtime
and time-formatting functions like fprintftime and nstrftime. For
'stat' this change is mostly just a code cleanup but it also
causes stat to also print nanoseconds when printing time stamps
that are out of localtime range, as this is more consistent with
what other programs do. For programs other than 'stat' this fixes
bugs with time zone formats that use %Z.
* src/du.c, src/pr.c (localtz): New static var.
(main): Initialize it.
* src/du.c (show_date): New time zone argument, so that localtime
and fprintftime use the same time zone information. All callers
changed.
* tests/misc/time-style.sh: New file.
* tests/local.mk (all_tests): Add it.
* tests/misc/date.pl: Test alphabetic time zone abbreviations.
Diffstat (limited to 'tests/fmt')
0 files changed, 0 insertions, 0 deletions