Overview
| Artifact ID: | 93a795aab6c57feab73c77df50a4efbb45439082cb06f5e9f2f84d3b3ec82413 |
|---|---|
| Ticket: | f894a85b9a4412d77d4f3234e5a244b7b4d476a2
Free-form clock scan silently wraps numbers that do not fit into an int (regression in 9.0) |
| User & Date: | serhiy.storchaka on 2026-11-14 09:29:03 |
Changes
- icomment:
Proposed fix in branch [clock-freescan-int-range](/timeline?r=clock-freescan-int-range). Numbers that do not fit into an int are rejected instead of truncated, and relative counts are calculated in 64 bits. The branch also fixes the following bugs. Relative months and years before the common era go in the wrong direction (base 101-03-15 B.C.E., `-gmt 1`): | Input | 8.6.18 and 9.0 | Branch | |---|---|---| | `clock scan "1 year"` | 102-03-15 B.C.E. | 100-03-15 B.C.E. | | `clock scan "13 months"` | 102-04-15 B.C.E. | 100-04-15 B.C.E. | | `clock scan "next Feb"` | 102-02-15 B.C.E. | 100-02-15 B.C.E. | | `clock add $base 1 year` | 102-03-15 B.C.E. | 100-03-15 B.C.E. | Signed integer overflows with `-valid 0` (`-base 0 -gmt 1`). The overflow is undefined behaviour; the 9.0 values are what gcc gives: | Input | 9.0 | Branch | |---|---|---| | `Dec 31 2147483647` (time 21474836:47) | 31450692 | 77340862020 | | `02/2147483647/2026` | -185540816332800 | 185544356918400 | | `14/02/2147483647` | 67675204942704000 | 67767976236297600 | Overflows in `clock add` (`-gmt 1`): | Input | 9.0 | Branch | |---|---|---| | `clock add 0 67553994410557440 hours` | 3386706919782612992 | integer value too large to represent | | `clock add 0 2147483647 weekdays` | -111325552329600 | 259759622044800 | | `clock add 0 2147483647 years` | -31536000 | integer value too large to represent | `clock add` now raises "integer value too large to represent" for a result outside the range of clock seconds, as it already does for such a base. Before, `clock add 0 67553994410557440 seconds 67553994410557440 seconds` returned 135107988821114880, which `clock format` does not accept.
- login: "serhiy.storchaka"
- mimetype: "text/x-markdown"