Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[interp limit time -seconds] has a y2k38 problem

Closed / Fixed3e8074aea74539cfd981ad6912c52c1488fc89c4Created 4 years agoUpdated 4 years ago
Descriptionmarkdown2023-01-12 17:07:02
% set i [interp create]
interp0
% $i limit time -seconds [expr {2**31-1}]
% $i limit time -seconds [expr {2**31}]
seconds must be at least 0
% $i limit time -seconds [expr {2**32}]
integer value too large to represent as non-long integer

This breaks several of the interp-34.* tests that use interp limit time -seconds when run on a system whose time is past clock format [expr {2**31-1}].

A quick look at the code in tclInterp.c showed that ChildTimeLimitCmd() parses the argument to the -seconds switch using TclGetIntFromObj() where TclGetLongFromObj() or even TclGetWideIntFromObj() (like [clock format]) seems more appropriate to match up with the rest of time handling in Tcl, which doesn't have a y2k38 problem in general.

Referenced by3
  • e040668a1dTicket [86dd172271] interp.test fails if clock is set to year 2040 (even on 64 bit machines) status still Open with 3 other changes ticket2023-08-23 16:10:22
  • cd0c8575c4Fix [3e8074aea7]: [interp limit time -seconds] has a y2k38 problem check-in2023-01-22 22:53:36
  • 504171c4e4Proposed fix for [3e8074aea7]: [interp limit time -seconds] has a y2k38 problem check-in2023-01-19 21:36:05
jan.nijtmanswiki2023-01-19 21:41:15

Proposed fix [here]

jan.nijtmanswiki2023-01-27 21:49:28

Fix is now merged to core-8-6-branch (higher branches already had this fixed)

So, closing.

Log in (anonymous is fine) to add a comment.