Skip to content
Tcl Source Code History Of Ticket 32b88975f7
Login

History Of Ticket 32b88975f7

Artifacts Associated With Ticket 32b88975f7

  1. Ticket change [0cce8ed6a0] (rid 220427) by gahr on 2023-11-20 13:56:06:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized 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>
      
    5. foundin initialized to: "9.0"
    6. is_private initialized to: "0"
    7. login: "gahr"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "438e59f1f1c891b29d2528ed82d1e629cecc6336"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "gahr"
    14. subsystem initialized to: "06. Time Measurement"
    15. title initialized to: "clock format returns spurious errors"
    16. type initialized to: "Bug"
  2. Ticket change [564667533d] (rid 220478) by jan.nijtmans on 2023-11-20 20:55:07:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2460269.37161979"
    3. closer changed to: "jan.nijtmans"
    4. foundin changed to: "8.6"
    5. icomment:
      Fixed [af4b8088729ae455|here] (yes, that's 8.6) and up.
      
      Thanks for the report and the patch!
      
    6. login: "jan.nijtmans"
    7. mimetype: "text/x-fossil-wiki"
    8. resolution changed to: "Fixed"
    9. status changed to: "Closed"