Artifacts Associated With Ticket 86dd172271f35ac4
Ticket change [d6601c105e] (rid 217050) by kanavin on 2023-08-07 11:44:44:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
When system date is set to 2040 (e.g. post-2038), interp.test starts producing failures, this is the output. I suspect there's a 32 bit integer in use for time somewhere? Note that this happens on 64 bit x86_64 machine, so the issue seems specific to tcl. ``` FAIL: interp.test Tests running in interp: /usr/lib/tcl/ptest/tcltest Tests located in: /usr/lib/tcl/ptest/tests Tests running in: /usr/lib/tcl/ptest Temporary files stored in /usr/lib/tcl/ptest Test files run in separate interpreters Running tests that match: * Skipping test files that match: l.*.test Only running test files that match: interp.test Tests began at Thu Feb 02 00:01:54 GMT 2040 interp.test ==== interp-34.3 basic test of limits - pure bytecode loop FAILED ==== Contents of test case: set i [interp create] $i eval { proc foobar {} { while {1} { # No bytecode at all here... } } } # We use a time limit here; command limits don't trap this case $i limit time -seconds [expr {[clock seconds]+2}] $i eval foobar ---- Result was: seconds must be at least 0 ---- Result should have been (exact matching): time limit exceeded ==== interp-34.3 FAILED ==== interp-34.3.1 basic test of limits - pure inside-command loop FAILED ==== Contents of test case: set i [interp create] $i eval { proc foobar {} { set while while $while {1} { # No bytecode at all here... } } } # We use a time limit here; command limits don't trap this case $i limit time -seconds [expr {[clock seconds] + 2}] $i eval foobar ---- Result was: seconds must be at least 0 ---- Result should have been (exact matching): time limit exceeded ==== interp-34.3.1 FAILED ==== interp-34.8 time limits trigger in vwaits FAILED ==== Contents of test case: set i [interp create] interp limit $i time -seconds [expr {[clock seconds] + 1}] -granularity 1 $i eval { set x {} vwait x } ---- Result was: seconds must be at least 0 ---- Result should have been (exact matching): limit exceeded ==== interp-34.8 FAILED ==== interp-34.9 time limits trigger in blocking after FAILED ==== Contents of test case: set i [interp create] set t0 [clock seconds] interp limit $i time -seconds [expr {$t0 + 1}] -granularity 1 set code [catch { $i eval {after 10000} } msg] set t1 [clock seconds] interp delete $i list $code $msg [expr {($t1-$t0) < 3 ? "OK" : $t1-$t0}] ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: seconds must be at least 0 while executing "interp limit $i time -seconds [expr {$t0 + 1}] -granularity 1" ("uplevel" body line 4) invoked from within "uplevel 1 $script" ---- errorCode: TCL OPERATION INTERP BADVALUE ==== interp-34.9 FAILED ==== interp-34.11 time limit extension in callbacks FAILED ==== Contents of test case: set i [interp create] set t0 [clock seconds] $i limit time -seconds [expr {$t0 + 1}] -granularity 1 -command "cb1 $i [expr {$t0 + 2}]" set ::result {} lappend ::result [catch { $i eval { for {set i 0} {$i<30} {incr i} { after 100 } } } msg] $msg set t1 [clock seconds] lappend ::result [expr {$t1-$t0>=2 ? "ok" : "$t0,$t1"}] interp delete $i return $::result ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: seconds must be at least 0 while executing "$i limit time -seconds [expr {$t0 + 1}] -granularity 1 -command "cb1 $i [expr {$t0 + 2}]"" ("uplevel" body line 4) invoked from within "uplevel 1 $script" ---- errorCode: TCL OPERATION INTERP BADVALUE ==== interp-34.11 FAILED ==== interp-34.12 time limit extension in callbacks FAILED ==== Contents of test case: set i [interp create] set t0 [clock seconds] set ::times "[expr {$t0 + 2}] [expr {$t0 + 100}]" $i limit time -seconds [expr {$t0 + 1}] -granularity 1 -command "cb1 $i" set ::result {} lappend ::result [catch { $i eval { for {set i 0} {$i<30} {incr i} { after 100 } } } msg] $msg set t1 [clock seconds] lappend ::result [expr {$t1-$t0>=2 ? "ok" : "$t0,$t1"}] interp delete $i return $::result ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: seconds must be at least 0 while executing "$i limit time -seconds [expr {$t0 + 1}] -granularity 1 -command "cb1 $i"" ("uplevel" body line 5) invoked from within "uplevel 1 $script" ---- errorCode: TCL OPERATION INTERP BADVALUE ==== interp-34.12 FAILED ==== interp-34.13 time limit granularity and vwait: Bug 2891362 FAILED ==== Contents of test case: $i limit time -seconds [clock add [clock seconds] 1 second] $i eval { after 2000 set x timeout vwait x return $x } ---- Result was: seconds must be at least 0 ---- Result should have been (exact matching): limit exceeded ==== interp-34.13 FAILED Tests ended at Thu Feb 02 00:01:55 GMT 2040 all.tcl: Total 351 Passed 337 Skipped 7 Failed 7 Sourced 1 Test Files. Files with failing tests: interp.test Number of tests skipped for each constraint: 7 knownBug ``` - foundin initialized to: "8.6.13"
- is_private initialized to: "0"
- login: "kanavin"
- priority initialized to: "5 Medium"
- private_contact initialized to: "316aee5d655ccb7cd0e5d969e9f2b16e4e95a50c"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "kanavin"
- subsystem initialized to: "20. [interp]"
- title initialized to:
interp.test fails if clock is set to year 2040 (even on 64 bit machines)
- type initialized to: "Bug"
Add attachment "0001-generic-tcl.h-use-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch" [075d3b53db] (rid 217296) by kanavin on 2023-08-23 13:41:49.
Add attachment "0002-tclInterp.c-use-Tcl_WideInt-for-seconds-in-ChildTime.patch" [406d642bcb] (rid 217297) by kanavin on 2023-08-23 13:42:10.
Ticket change [2ba9e9ca37] (rid 217302) by chrstphrchvz on 2023-08-23 16:03:25:
- icomment:
The patch for tcl.h proposes an ABI change (on systems with 32-bit <tt>long</tt>). It can be considered for Tcl 9, but not 8.6 or 8.7.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [e040668a1d] (rid 217303) by chrstphrchvz on 2023-08-23 16:10:22:
- icomment:
The patch for tclInterp.c resembles changes which were already made for [3e8074aea7]. I believe this ticket is a duplicate.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [55a30a2da8] (rid 217387) by jan.nijtmans on 2023-08-26 20:38:42:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2460183.36021419"
- closer changed to: "jan.nijtmans"
- icomment:
> The patch for tcl.h proposes an ABI change (on systems with 32-bit long). It can be considered for Tcl 9, but not 8.6 or 8.7. I think Tcl_Time.sec _must_ be updated to "long long" in Tcl 9.0, otherwise we can never be sure that 2038-related bugs won't show up on 32-bit platforms. Therefore: [19499b816370cd3f] Thanks!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [c70026df6d] (rid 217389) by jan.nijtmans on 2023-08-27 16:16:03:
- closer changed to: "nobody"
- icomment:
This ticket cannot be closed yet: Build is failing on Windows with --enable-symbols=(mem|all). Don't know yet why.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Pending"
Ticket change [396e1477d1] (rid 217413) by kanavin on 2023-08-28 08:48:15:
- icomment:
I need to add a bit of background information: in scope of Yocto project (distribution toolkit for Linux-based embedded systems) I am testing whether a complete system keeps working if system date is set to 2040, both on 64 bit and 32 bit targets. 'Keeps working' means as well running as many component-specific test suites as possible, including tcl, as of currently released version. This ticket is the outcome of that work: on 64 bit systems interp.test starts failing as shown, and on 32 bit systems a few additional failures start to happen (I didn't document them separately, but they do occur). With the two attached patches all failures are resolved. I'm happy to have the issues resolved elsewhere, or I can do additional work to merge them. As long as the issues are both known, and eventually fixed.
- login: "kanavin"
- mimetype: "text/plain"
- icomment:
Ticket change [80bed103ab] (rid 221219) by jan.nijtmans on 2024-01-08 14:43:55:
- closedate changed to: "2460318.11383751"
- closer changed to: "jan.nijtmans"
- icomment: "Fixed for 9.0"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Closed"