GNU bug report logs -
#23035
date: regression in timezone printing (+%Z)
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Thu, 17 Mar 2016 10:38:06 -0700
with message-id <56EAEB7E.1090402 <at> cs.ucla.edu>
and subject line Re: bug#23035: date: regression in timezone printing (+%Z)
has caused the debbugs.gnu.org bug report #23035,
regarding date: regression in timezone printing (+%Z)
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
23035: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23035
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Hello,
I think there's a small regression in coreutils 8.25 date command with
regards to timezone printing on a machine without native 'timezone_t'.
Example:
$ uname -a
SunOS unstable10x 5.10 Generic_147441-19 i86pc i386 i86pc
$ export TZ=Asia/Tokyo
$ ./coreutils-8.24/src/date +%Z
JST
$ ./coreutils-8.25/src/date +%Z
[[[empty line]]]
I suspect it has something to do with this commit:
commit 037e3b9847feb46cf6b58d99ce960d3987faaf52
date: 2015-07-24 01:49:31 (GMT)
subject: build: fprintftime/nstrftime API changes
configuration values on this machine:
$ ggrep -E 'TZ|ZONE' lib/config.h
#define GETTIMEOFDAY_TIMEZONE void
#define HAVE_DECL_TZNAME 1
#define HAVE_RUN_TZSET_TEST 1
/* #undef HAVE_STRUCT_TM_TM_ZONE */
/* #undef HAVE_TIMEZONE_T */
`HAVE_STRUCT_TM_TM_ZONE' instead. */
/* #undef HAVE_TM_ZONE */
#define HAVE_TZNAME 1
#define HAVE_TZSET 1
/* #undef TZSET_CLOBBERS_LOCALTIME */
Trying to debug, I see the following:
1. in 'date.c', show_date() calls fprintftime (in ./lib/strftime.c).
The values upon entry are:
fprintftime (s=0x8079c10 <_iob+16>, format=0x8047ccd "%Z",
tp=0xfef30200, tz=0x807b028,
ns=446195784) at lib/strftime.c:1465
(gdb) p *tz
$6 = {next = 0x0, tzname_copy = {0x0, 0x0}, tz_is_set = 1 '\001',
abbrs = 0x807b035 "Asia/Tokyo"}
2. stepping through ./lib/strftime.c:445 has this:
445 char **tzname_vec = tzname;
(gdb) p tzname
$10 = {0xfef302c4 "JST", 0xfef30304 "JDT"}
3. ./lib/strftime.c:484 has this, which sets tzname_vec to nulls (from 'tz',
originating from 'tzalloc'):
(gdb) n
484 tzname_vec = tz->tzname_copy;
(gdb) n
493 if (!(zone && *zone) && tp->tm_isdst >= 0) {
(gdb) p tzname_vec
$3 = (char **) 0x807b02c
(gdb) p *tzname_vec
$4 = 0x0
(gdb) p zone
$5 = 0x0
(gdb) n
494 zone = tzname_vec[tp->tm_isdst != 0];
(gdb) n
496 if (! zone)
(gdb) p zone
$6 = 0x0
(gdb) n
497 zone = "";
From this point on, 'zone' is an empty string, and that's what is printed
by 'date'.
Not sure where to start at fixing it, but I hope the attached patch can be
used to test it.
Happy to test things further if needed.
regards,
- assaf
[Message part 4 (text/html, inline)]
[0001-tests-test-date-Z-behaviour.patch (text/x-patch, attachment)]
[Message part 6 (message/rfc822, inline)]
[Message part 7 (text/plain, inline)]
On 03/16/2016 08:51 PM, Assaf Gordon wrote:
> I suspect it has something to do with this commit:
> commit 037e3b9847feb46cf6b58d99ce960d3987faaf52
You're right, and thanks for that detailed bug report. I installed the
attached patch, which fixed the bug for me.
[0001-date-ls-pr-fix-time-zone-abbrs-on-SysV-platforms.patch (application/x-patch, attachment)]
This bug report was last modified 8 years and 180 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.