Artifacts Associated With Ticket d40b9c8503eb
Ticket change [12308a95d4] (rid 209889) by chrstphrchvz on 2023-03-08 09:38:00:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
To what extent does/should Tcl 9.0 assume/require/enforce 64-bit <tt>time_t</tt>? Currently, when I build Tcl 9.0 on ia32 (32-bit x86) Linux, it uses 32-bit <tt>time_t</tt>, but the tests cmdAH-24.20.1 and cmdAH-24.20.2 fail (rather than skip as with 8.7; timestamp 3155760000 overflows to -1139207296). I can also reproduce the issue in [fa128568a597]. (Maybe the same would happen for 32-bit ARM.) I read elsewhere that glibc 2.34 and Linux kernel 5.6 support 64-bit <tt>time_t</tt> on 32-bit systems by compiling with <tt>_FILE_OFFSET_SIZE=64</tt> and <tt>_TIME_BITS=64</tt> defined, and that future glibc may even define these by default. I tried building Tcl 9.0 again with these defined, and confirmed that doing so avoids the overflow issues. This approach reportedly supersedes/conflicts with the approach of defining <tt>_LARGEFILE64_SOURCE</tt>, as proposed in the bug-02b58d5d04 branch. Would it be appropriate for Tcl/Tk to instead define <tt>_FILE_OFFSET_SIZE=64</tt> and <tt>_TIME_BITS=64</tt> by default (possibly before package managers all begin separately trying to do so themselves)?
- foundin initialized to: "trunk"
- is_private initialized to: "0"
- login: "chrstphrchvz"
- priority initialized to: "5 Medium"
- private_contact initialized to: "6133eb3026f9b10aa9b7b48da92ae2834fc225b0"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "chrstphrchvz"
- subsystem initialized to: "52. Portability Support"
- title initialized to: "Enforcing 64-bit time_t?"
- type initialized to: "RFE"
Ticket change [06fab267d9] (rid 209894) by jan.nijtmans on 2023-03-08 10:00:11:
- icomment:
> To what extent does/should Tcl 9.0 assume/require/enforce 64-bit <tt>time_t</tt>? I think that Tcl 9.0 - indeed - should enforce 64-bit time_t. That used to be a problem in Windows (since older msvcrt libraries don't have 64-bit time functions), but that's solved now. So, if you want to provide a patch for your platform (best place would be in tcl.m4), yes please!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [89e2caa777] (rid 210756) by chrstphrchvz on 2023-03-24 13:31:00:
- comment changed to:
To what extent does/should Tcl 9.0 assume/require/enforce 64-bit <tt>time_t</tt>? Currently, when I build Tcl 9.0 on ia32 (32-bit x86) Linux, it uses 32-bit <tt>time_t</tt>, but the tests cmdAH-24.20.1 and cmdAH-24.20.2 fail (rather than skip as with 8.7; timestamp 3155760000 overflows to -1139207296). I can also reproduce the issue in [fa128568a597]. (Maybe the same would happen for 32-bit ARM.) I read elsewhere that glibc 2.34 and Linux kernel 5.6 support 64-bit <tt>time_t</tt> on 32-bit systems by compiling with <tt>_FILE_OFFSET_SIZE=64</tt> and <tt>_TIME_BITS=64</tt> defined, and that future glibc may even define these by default. I tried building Tcl 9.0 again with these defined, and confirmed that doing so avoids the overflow issues. This approach reportedly supersedes<s>/conflicts</s> with the approach of defining <tt>_LARGEFILE64_SOURCE</tt>, as <s>proposed</s> removed in the bug-02b58d5d04 branch. Would it be appropriate for Tcl/Tk to instead define <tt>_FILE_OFFSET_SIZE=64</tt> and <tt>_TIME_BITS=64</tt> by default (possibly before package managers all begin separately trying to do so themselves)?
- icomment:
I believe I misunderstood the purpose of the bug-02b58d5d04 branch, and that the proposal in this ticket would actually complement the work in it: <tt>_FILE_OFFSET_BITS=64</tt> affects the functions exposed by <tt>_LARGEFILE_SOURCE</tt>, as an alternative to using functions exposed by <tt>_LARGEFILE64_SOURCE</tt> which that branch removes usage of. Can that branch please be updated from the current main branch?
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- comment changed to:
Ticket change [ba2b2fa71d] (rid 210938) by chrstphrchvz on 2023-03-26 05:34:21:
- icomment:
<blockquote>I think that Tcl 9.0 - indeed - should enforce 64-bit time_t. … So, if you want to provide a patch for your platform (best place would be in tcl.m4), yes please!</blockquote> Thanks for the suggestion, I have zero experience with M4 but have cargo culted roughly how this could be done anyway: <ul> <li>Hack <tt>SC_TCL_EARLY_FLAG()</tt> to accept a 4th optional argument for the value to define a C macro to (<tt>1</tt> by default)</li> <li>Define <tt>_FILE_OFFSET_BITS=64</tt> during <tt>SC_TCL_EARLY_FLAGS</tt> if that is needed to get 64-bit <tt>off_t</tt></li> <li> Define <tt>_TIME_BITS=64</tt> during <tt>SC_TCL_64BIT_FLAGS</tt> if that is needed to get 64-bit <tt>time_t</tt></li> <li>Error out if 64-bit <tt>time_t</tt> is unavailable. </li> </ul> See [https://github.com/tcltk/tcl/compare/main...chrstphrchvz:tcl:timet64] (currently based on main branch, but would eventually prefer to base it on bug-02b58d5d04).
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [09fae44c06] (rid 210939) by chrstphrchvz on 2023-03-26 05:38:44:
- icomment:
Also, I may also be underestimating how controversial it would be for Tcl 9.0 to require 64-bit <tt>time_t</tt>, as this would drop support (if they haven’t been dropped already) for certain less popular systems such as FreeBSD i386.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [5bb9319abb] (rid 210963) by jan.nijtmans on 2023-03-26 15:56:32:
- assignee changed to: "jan.nijtmans"
- icomment:
Thanks for the patch. I committed it to its own [58faf80de7e28662|branch] in order to do some testing. In the meantime I also did some thinking what way I would like to go. Your implementation exactly looks like that! Many thanks, I like it! I don't think it's really necessary to officially drop support for systems with a 32-bit time_t. A few failing testcases (showing that time functions won't work as expected after 2038 any more) should be enough.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [a13771a8f3] (rid 213938) by chrstphrchvz on 2023-04-27 04:37:05:
- comment changed to:
To what extent does/should Tcl 9.0 assume/require/enforce 64-bit <tt>time_t</tt>? Currently, when I build Tcl 9.0 on ia32 (32-bit x86) Linux, it uses 32-bit <tt>time_t</tt>, but the tests cmdAH-24.20.1 and cmdAH-24.20.2 fail (rather than skip as with 8.7; timestamp 3155760000 overflows to -1139207296). I can also reproduce the issue in [fa128568a597]. (Maybe the same would happen for 32-bit ARM.) I read elsewhere that glibc 2.34 and Linux kernel 5.6 support 64-bit <tt>time_t</tt> on 32-bit systems by compiling with <tt>_FILE_OFFSET_BITS=64</tt> and <tt>_TIME_BITS=64</tt> defined, and that future glibc may even define these by default. I tried building Tcl 9.0 again with these defined, and confirmed that doing so avoids the overflow issues. This approach reportedly supersedes<s>/conflicts</s> with the approach of defining <tt>_LARGEFILE64_SOURCE</tt>, as <s>proposed</s> removed in the bug-02b58d5d04 branch. Would it be appropriate for Tcl/Tk to instead define <tt>_FILE_OFFSET_BITS=64</tt> and <tt>_TIME_BITS=64</tt> by default (possibly before package managers all begin separately trying to do so themselves)?
- login: "chrstphrchvz"
- mimetype: "text/plain"
- comment changed to:
Ticket change [9d374682fc] (rid 216600) by jan.nijtmans on 2023-07-20 08:33:15:
- icomment:
Trying this branch on 32-bit Ubuntu: <pre> .... checking for 64-bit time_t... no checking if _TIME_BITS=64 enables 64-bit time_t... no configure: error: no 64-bit time_t available </pre> So, it's not right yet
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [18c15f9c31] (rid 216601) by chrstphrchvz on 2023-07-20 10:06:57:
- icomment:
Jan, can I please take a look at config.log if possible? Which Ubuntu version is used?
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Add attachment "config.log" [48a6d3e37e] (rid 216603) by jan.nijtmans on 2023-07-20 10:38:02.
Ticket change [98b883d4aa] (rid 216604) by jan.nijtmans on 2023-07-20 10:38:47:
- icomment: "Ubuntu-16.04.1"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [42b9276eff] (rid 216605) by jan.nijtmans on 2023-07-20 10:39:13:
- icomment: "config.log now attached to this ticket"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [2ed01555c7] (rid 216606) by chrstphrchvz on 2023-07-20 11:47:24:
- icomment:
Thanks. Unfortunately, the glibc and kernel version in Ubuntu 16.04 will not support this approach, so what you see is expected. Ubuntu 21.10 (the first release with glibc 2.34) is likely the earliest that will work.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [872a1b4e5f] (rid 216611) by jan.nijtmans on 2023-07-20 12:49:13:
- closedate changed to: "2460146.03418485"
- closer changed to: "jan.nijtmans"
- icomment:
In that case, we shouldn't _enforce_ time64_t, just encourage it, doing everything possible to enable it. If that's not possible, everything works except 2 test-case failures: that should be enough warning not to trust the system any more when the year approaches 2038. OK? Many thanks!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [f41b0b56b7] (rid 216612) by chrstphrchvz on 2023-07-20 13:06:44:
- closedate changed to: "2460146.04634707"
- closer changed to: "chrstphrchvz"
- icomment:
In that case, I would suggest leaving a message in cmdAH-24.20.1/cmdAH-24.20.2 about the expected failures, so as to avoid further duplicate bug reports or someone adding back the <tt>time64bit</tt> constraint.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
Ticket change [ceb18e804c] (rid 216618) by jan.nijtmans on 2023-07-20 13:34:22:
- closedate changed to: "2460146.06553888"
- closer changed to: "jan.nijtmans"
- icomment: "[cc0fee411c13b2b5]. Thanks!"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [759646e4fc] (rid 216619) by jan.nijtmans on 2023-07-20 13:35:56:
- closedate changed to: "2460146.06663124"
- icomment:
If a system has a 64-bit time_t, but those 2 testcases fail, we still want a bug-report!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"