diff mbox series

[2/3] tcl8: add a patch to address Y2038 issues (tcl 9.x doesn't need it)

Message ID 20250122100324.1561841-2-alex.kanavin@gmail.com
State Accepted, archived
Commit 50731c5233f1531b1a7a9ac94c08235e06be8c2d
Headers show
Series [1/3] tcl: disable 'zipfs' feature | expand

Commit Message

Alexander Kanavin Jan. 22, 2025, 10:03 a.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 ...e-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch | 33 +++++++++++++++++++
 meta/recipes-devtools/tcltk8/tcl8_8.6.16.bb   |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta/recipes-devtools/tcltk8/tcl8/0001-generic-tcl.h-use-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/tcltk8/tcl8/0001-generic-tcl.h-use-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch b/meta/recipes-devtools/tcltk8/tcl8/0001-generic-tcl.h-use-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch
new file mode 100644
index 00000000000..18599928385
--- /dev/null
+++ b/meta/recipes-devtools/tcltk8/tcl8/0001-generic-tcl.h-use-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch
@@ -0,0 +1,33 @@ 
+From ff508f2e6786df697876140f21855ecb92a3ed36 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex@linutronix.de>
+Date: Fri, 18 Aug 2023 12:25:11 +0200
+Subject: [PATCH] generic/tcl.h: use Tcl_WideInt for seconds in Tcl_Time
+
+This ensures the value will not overflow, particularly on 32 bit systems
+in 2038, where long will.
+
+This patch was proposed at https://core.tcl-lang.org/tcl/tktview/86dd172271
+Upstream was generally supportive of the fix, but they merged a much more
+elaborate version of it for tcl 9.x (released in 9.0.0), and declined
+to merge it into 8.x due to ABI breakage (sadly this change is in a public header).
+But we can carry the fix downstream.
+
+Upstream-Status: Inappropriate [see above]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ generic/tcl.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/generic/tcl.h b/generic/tcl.h
+index 3a4622e..6204c57 100644
+--- a/generic/tcl.h
++++ b/generic/tcl.h
+@@ -1418,7 +1418,7 @@ typedef enum {
+  */
+ 
+ typedef struct Tcl_Time {
+-    long sec;			/* Seconds. */
++    Tcl_WideInt sec;			/* Seconds. */
+     long usec;			/* Microseconds. */
+ } Tcl_Time;
+ 
diff --git a/meta/recipes-devtools/tcltk8/tcl8_8.6.16.bb b/meta/recipes-devtools/tcltk8/tcl8_8.6.16.bb
index c8f4b5df2aa..076bbc906c4 100644
--- a/meta/recipes-devtools/tcltk8/tcl8_8.6.16.bb
+++ b/meta/recipes-devtools/tcltk8/tcl8_8.6.16.bb
@@ -23,6 +23,7 @@  SRC_URI = "${BASE_SRC_URI} \
            file://alter-includedir.patch \
            file://interp.patch \
            file://run-ptest \
+           file://0001-generic-tcl.h-use-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch \
            "
 SRC_URI[sha256sum] = "3b371386a9a928eecdbf263bcab7d6a531e620ca3fbab4fdeeb3d6a9a56f38e9"