emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#23035: closed (date: regression in timezone printi


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#23035: closed (date: regression in timezone printing (+%Z))
Date: Thu, 17 Mar 2016 17:39:02 +0000

Your message dated Thu, 17 Mar 2016 10:38:06 -0700
with message-id <address@hidden>
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
address@hidden)


-- 
23035: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23035
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: date: regression in timezone printing (+%Z) Date: Wed, 16 Mar 2016 23:51:42 -0400
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
 

Attachment: 0001-tests-test-date-Z-behaviour.patch
Description: Text Data


--- End Message ---
--- Begin Message --- Subject: Re: bug#23035: date: regression in timezone printing (+%Z) Date: Thu, 17 Mar 2016 10:38:06 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
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.

Attachment: 0001-date-ls-pr-fix-time-zone-abbrs-on-SysV-platforms.patch
Description: Source code patch


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]