bug-gnulib
[Top][All Lists]
Advanced

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

debugging a nstrftime test failure


From: Bruno Haible
Subject: debugging a nstrftime test failure
Date: Fri, 21 Apr 2023 00:20:44 +0200

Hi Paul,

As the nstrftime test is failing on several platforms [1], I'm trying to
debug it.

Now I'm on mingw 10. The output of test-nstrftime is sometimes

PST8PDT,M3.2.0,M11.1.0: expected "1969-12-31 16:00:00 -0800 (PST)", got 
"1969-12-31 16:00:00  (PST)"
MST7: expected "1969-12-31 17:00:00 -0700 (MST)", got "1969-12-31 17:00:00  
(MST)"
CET-1CEST,M3.5.0,M10.5.0/3: expected "1970-01-01 01:00:00 +0100 (CET)", got 
"1970-01-01 01:00:00 +0100 (W. Europe Standard Time)"
NZST-12NZDT,M9.5.0,M4.1.0/3: expected "1970-01-01 13:00:00 +1300 (NZDT)", got 
"1970-01-01 01:00:00  (W. Europe Standard Time)"
CET-1CEST,M3.5.0,M10.5.0/3: expected "1985-11-05 01:53:21 +0100 (CET)", got 
"1985-11-05 01:53:21 +0100 (W. Europe Standard Time)"
NZST-12NZDT,M9.5.0,M4.1.0/3: expected "1985-11-05 13:53:21 +1300 (NZDT)", got 
"1985-11-05 01:53:21 +0100 (W. Europe Standard Time)"
CET-1CEST,M3.5.0,M10.5.0/3: expected "2001-09-09 03:46:42 +0200 (CEST)", got 
"2001-09-09 03:46:42 +0200 (W. Europe Daylight Time)"
NZST-12NZDT,M9.5.0,M4.1.0/3: expected "2001-09-09 13:46:42 +1200 (NZST)", got 
"2001-09-09 03:46:42 +0200 (W. Europe Daylight Time)"

or sometimes only the first two lines of this:

PST8PDT,M3.2.0,M11.1.0: expected "1969-12-31 16:00:00 -0800 (PST)", got 
"1969-12-31 16:00:00  (PST)"
MST7: expected "1969-12-31 17:00:00 -0700 (MST)", got "1969-12-31 17:00:00  
(MST)"

I've commented out the other test cases and am concentrating on the line

MST7: expected "1969-12-31 17:00:00 -0700 (MST)", got "1969-12-31 17:00:00  
(MST)"

We're in main() at test-nstrftime.c:333
invokes tzalloc_test() at test-nstrftime.c:193
invokes nstrftime() at nstrftime.c:424, with format = "%Y-%m-%d %H:%M:%S %z 
(%Z)"
invokes __strftime_internal() at nstrftime.c:1433
invokes mktime_z at time_rz.c:306

The test failures arises because in this case %z has produced the empty
string as output.

In nstrftime() we're here:

                ltm = *tp;
                ltm.tm_wday = -1;
                lt = mktime_z (tz, &ltm);
                if (ltm.tm_wday < 0 || ! localtime_rz (0, &lt, &gtm))
                  break;
                diff = tm_diff (&ltm, &gtm);

tz = { next = 0, tzname_copy = {"MST", 0}, tz_is_set = 1, abbrs = "MST7" }

mktime_z does not change ltm. After the mktime_z call, ltm.tm_wday is still -1:
ltm = {
  tm_sec = 0
  tm_min = 0
  tm_hour = 17
  tm_mday = 31
  tm_mon = 11
  tm_year = 69
  tm_wday = -1    <---
  tm_yday = 364
  tm_isdst = 0
}

One level deeper, in time_rz.c:304, we get t = -1. mktime (which really
is rpl_mktime) has returned -1. Then ok gets set to false.

How to get further? Should I add this specific mktime call as a test
case to the 'mktime' module's tests?

Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00159.html






reply via email to

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