Tcl Source Code

View Ticket
Login
Ticket UUID: f9764cd7a938fca3a91b087a6a5bd635cea1a216
Title: tcl Tcl_CreateTimerHandler has flaws which may never invoker input function
Type: Bug Created on: 2023-09-21 15:08:44
Submitter: anonymous Assigned to: nobody
Subsystem: 55. Other Tools Severity: Important
Priority: 5 Medium Last modified: 2023-09-21 15:08:44
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: TCL 8.6.8
Description:

Current date:Thu Sep 21 02:55:28 PM UTC 2023 Step1: cat << EOF > test.sh #!/usr/bin/expect

sleep 10

EOF

Step2: date -s "Thu Sep 14 20:13:49 CST 2138" ; expect -d test.sh &

Step3: date -s "Thu Sep 14 20:13:49 CST 2023"

Expected behaviour

'expect -d test.sh' will be executed after 10 seconds.

Real outcome

'expect -d test.sh' not executed until 7 days later (Sep 14 to Sep 21)

Possible fix

I think this is becuase expect software uses Tcl_CreateTimerHandler()function, which use absolutetime to measure how many seconds to wait before invoking function. And the amoung of seconds to wait can be changed by modifying current date of OS system.

Question is: is this an expected behavior of TCL? And change the Tcl_GetTime() function to retrieve relative time by using CLOCK_MONOTONIC