Overview
| Artifact ID: | 0cce8ed6a0ba3292f4af81dcdd7a8e07d593f6ca4af1caa30995bb5d1613c814 |
|---|---|
| Ticket: | 32b88975f794c39d29308ec8bcd4aafd779f220a
clock format returns spurious errors |
| User & Date: | gahr on 2023-11-20 13:56:06 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
In ConvertLocalToUTCUsingC, we use mktime then check errno without checking whether mktime returned an error, i.e., -1. As nicely explained in [https://mm.icann.org/pipermail/tz/2016-July/023904.html|this thread on the tz mailing list], doing so is an error. As it turns out, in FreeBSD we use a version of tz's code that sets errno internally even on the success path. This results in [clock scan] erroring out even on valid input: <verbatim type=tcl> clock scan 2000-01-01T00:00:00 -timezone :localtime -format %Y-%m-%dT%H:%M:%S time value too large/small to represent </verbatim> Here's the patch I suggest: <verbatim type=diff> --- generic/tclClock.c.orig 2023-11-03 19:56:24.000000000 +0000 +++ generic/tclClock.c 2023-11-20 13:49:18.128631000 +0000 @@ -894,7 +894,7 @@ Tcl_MutexLock(&clockMutex); errno = 0; fields->seconds = (Tcl_WideInt) mktime(&timeVal); - localErrno = errno; + localErrno = fields->seconds == -1 ? errno : 0; Tcl_MutexUnlock(&clockMutex); /* </verbatim> - foundin changed to: "9.0"
- is_private changed to: "0"
- login: "gahr"
- priority changed to: "5 Medium"
- private_contact changed to: "438e59f1f1c891b29d2528ed82d1e629cecc6336"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "gahr"
- subsystem changed to: "06. Time Measurement"
- title changed to: "clock format returns spurious errors"
- type changed to: "Bug"