bug-coreutils
[Top][All Lists]
Advanced

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

bug#50115: Found the line where it is failing


From: Jeremy Cantrell
Subject: bug#50115: Found the line where it is failing
Date: Wed, 18 Aug 2021 21:56:21 -0500

On line 2160 in `./gnulib/lib/parse-datetime.y`, there's this:

```c
          if (Start == (time_t) -1)
            {
              if (debugging (&pc))
                dbg_printf (_("error: adding relative date resulted "
                              "in an invalid date: '%s'\n"),
                            debug_strfdatetime (&tm, &pc, dbg_tm,
                                                sizeof dbg_tm));
              goto fail;
            }
```

This seems to indicate that, if the parsed value is -1, it's
considered an invalid date, but isn't -1 a valid date in epoch
seconds?

Passing --debug to the date shows the correct result, but claims it's invalid:

```sh
$ ./src/date --debug -u -d "1970-12-31T23:59:59+00:00 - 1 year"
date: parsed datetime part: (Y-M-D) 1970-12-31 23:59:59 UTC+00
date: parsed relative part: -1 year(s)
date: input timezone: parsed date/time string (+00)
date: using specified time as starting value: '23:59:59'
date: starting date/time: '(Y-M-D) 1970-12-31 23:59:59 TZ=+00'
date: warning: when adding relative months/years, it is recommended to
specify the 15th of the months
date: error: adding relative date resulted in an invalid date:
'(Y-M-D) 1969-12-31 23:59:59 TZ=+00'
./src/date: invalid date ‘1970-12-31T23:59:59+00:00 - 1 year’
```





reply via email to

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