Artifacts Associated With Ticket 8afd93d3d360b933
Ticket change [5d5ffc81c0] (rid 261619) by anonymous on 2026-11-13 22:13:29:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Platform: NetBSD 11.1 running on a Sun Ultra 5 (Sparc64, big-endian). Tcl is version 9.1.0. GCC is version 12.5.0. The issue: clock format commands return zero for hours/minutes/seconds. To reproduce: $ clock format [clock seconds] -format "%a %b %d %H:%M:%S" Expected result: Fri Nov 13 21:49:32 Actual result: Fri Nov 13 00:00:00 Many more clock functions appear to be affected as well, running 'make test' shows a very large number of errors in clock.test. Testing on an amd64 platform shows no errors in clock.test, which suggests a big/little endian issue. Looking at the source, secondOfDay is declared to be Tcl_WideInt in tclDate.h but is accessed using IntFieldAt() within tclClockFmt.c. That will read incorrect data on a big-endian host.
- foundin initialized to: "9.1.0"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "16. Commands A-H"
- title initialized to: "Clock format fails on NetBSD 11.1 on Sparc64"
- type initialized to: "Bug"
Ticket change [ac4ab67ff5] (rid 261622) by jan.nijtmans on 2026-11-13 23:03:40:
- assignee changed to: "sebres"
- icomment: "Does [2247d9b83c|this] help?"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [7218a85be6] (rid 261623) by serhiy.storchaka on 2026-11-13 23:14:15:
- icomment:
The two fields were int until [bbb77cc456] (the fix of an overflow in clock add, before TIP 688 was merged) widened them, but the format and scan tables still access them as int. They only hold a time of day, so the fix in [2247d9b83c] is right, and clock.test passes with it. One side effect: the free-form parser stores its 64-bit numbers into these int fields before the range check, so clock scan "12:00:4294967301" now gives 12:00:05 instead of "invalid time". Hours and minutes already behave this way: "12:4294967301:00" gives 12:05:00. A range check in tclGetDate.y before the assignment would fix all three.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [84043d1988] (rid 261625) by serhiy.storchaka on 2026-11-14 08:37:21:
- icomment:
I opened [f894a85b9a] for the range check and am working on it.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [fb5108dab3] (rid 263430) by jan.nijtmans on 2026-11-27 21:58:19:
- assignee changed to: "jan.nijtmans"
- icomment: "Merged to [537be3478b|trunk]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Pending"