Hi Paul,

Paul Eggert <egg...@cs.ucla.edu> writes:

> On 2025-06-08 17:39, Collin Funk wrote:
>> Posting on bug-gnulib since this test failure seems to be caused by
>> parse-datetime despite being caught by tests/date/date-debug.sh in
>> Coreutils.
>
> I installed the attached patch to Gnulib, along with a minor testcase
> patch in Coreutils. Please give it a try.

This fails with the following diff:

    + diff -u exp2 out2
    --- exp2    2025-06-10 04:15:06.472911681 +0000
    +++ out2    2025-06-10 04:15:06.518214174 +0000
    @@ -4,10 +4,10 @@
     date: using specified time as starting value: '02:30:00'
     date: error: invalid date/time value:
     date:     user provided time: '(Y-M-D) 2006-04-02 02:30:00'
    -date:        normalized time: '(Y-M-D) 2006-04-02 XX:XX:XX'
    -date:                                             --
    +date:     time could not be normalized
     date:      possible reasons:
     date:        nonexistent due to daylight-saving time;
     date:        invalid day/month combination;
    +date:        numeric values overflow;
     date:        missing timezone
     date: invalid date 'TZ="America/Edmonton" 2006-04-02 02:30:00'

The cause can be seen in 'gdb'. On GNU/Linux:

    debug_mktime_not_ok (tm0=0x7fffffffcbd0, tm1=0x7fffffffcb90, 
pc=0x7fffffffcde0, time_zone_seen=false) at 
/home/collin/.local/src/coreutils/parse-datetime.y:1698
    1698          if (mktime_failed)
    (gdb) print mktime_failed 
    $1 = false
    (gdb) print *tm1
    $2 = {
      tm_sec = 0,
      tm_min = 30,
      tm_hour = 3,
      tm_mday = 2,
      tm_mon = 3,
      tm_year = 106,
      tm_wday = 0,
      tm_yday = 91,
      tm_isdst = 1,
      tm_gmtoff = -21600,
      tm_zone = 0x4184da "MDT"
    }

On NetBSD 10.0:

    debug_mktime_not_ok (time_zone_seen=false, pc=0xffffffcc6940, 
tm1=0xffffffcc6728, tm0=0xffffffcc6760) at parse-datetime.y:1698
    1698          if (mktime_failed)
    (gdb) print *tm1
    $1 = {tm_sec = 0, tm_min = 30, tm_hour = 2, tm_mday = 2, tm_mon = 3, 
tm_year = 106, tm_wday = -1, tm_yday = 0, tm_isdst = -1, tm_gmtoff = 
281474674135736, 
      tm_zone = 0x15000 <error: Cannot access memory at address 0x15000>}
    (gdb) print mktime_failed 
    $2 = true

Collin

Reply via email to