From 6648ead5cf76fac6e655aa9103f9bcb8135d4f79cd5ec2538a9caf3448dc949f Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Mon, 6 Feb 2023 18:31:46 +0000 Subject: [PATCH] - bsc#1203982, tcl-interp-limit-time.patch: Fix a y2k38 problem in [interp limit -time] . OBS-URL: https://build.opensuse.org/package/show/devel:languages:tcl/tcl?expand=0&rev=153 --- tcl-interp-limit-time.patch | 53 +++++++++++++++++++++++++++++++++++++ tcl.changes | 6 +++++ tcl.spec | 2 ++ 3 files changed, 61 insertions(+) create mode 100644 tcl-interp-limit-time.patch diff --git a/tcl-interp-limit-time.patch b/tcl-interp-limit-time.patch new file mode 100644 index 0000000..654312f --- /dev/null +++ b/tcl-interp-limit-time.patch @@ -0,0 +1,53 @@ +Index: generic/tclInterp.c +================================================================== +--- generic/tclInterp.c ++++ generic/tclInterp.c +@@ -4684,11 +4684,11 @@ + case OPT_SEC: + if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_TIME)) { + Tcl_Time limitMoment; + + Tcl_LimitGetTime(childInterp, &limitMoment); +- Tcl_SetObjResult(interp, Tcl_NewLongObj(limitMoment.sec)); ++ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(limitMoment.sec)); + } + break; + } + return TCL_OK; + } else if ((objc-consumedObjc) & 1 /* isOdd(objc-consumedObjc) */) { +@@ -4742,28 +4742,30 @@ + "BADVALUE", NULL); + return TCL_ERROR; + } + limitMoment.usec = ((long) tmp)*1000; + break; +- case OPT_SEC: ++ case OPT_SEC: { ++ Tcl_WideInt sec; + secObj = objv[i+1]; + (void) Tcl_GetStringFromObj(objv[i+1], &secLen); + if (secLen == 0) { + break; + } +- if (TclGetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { ++ if (TclGetWideIntFromObj(interp, objv[i+1], &sec) != TCL_OK) { + return TCL_ERROR; + } +- if (tmp < 0) { ++ if (sec < 0) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "seconds must be at least 0", -1)); + Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", + "BADVALUE", NULL); + return TCL_ERROR; + } +- limitMoment.sec = tmp; ++ limitMoment.sec = sec; + break; ++ } + } + } + if (milliObj != NULL || secObj != NULL) { + if (milliObj != NULL) { + /* + diff --git a/tcl.changes b/tcl.changes index fcde941..d716cc5 100644 --- a/tcl.changes +++ b/tcl.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 6 18:29:45 UTC 2023 - Reinhard Max + +- bsc#1203982, tcl-interp-limit-time.patch: Fix a y2k38 problem + in [interp limit -time] . + ------------------------------------------------------------------- Tue Jan 17 11:21:29 UTC 2023 - Reinhard Max diff --git a/tcl.spec b/tcl.spec index 4b913c7..f86933c 100644 --- a/tcl.spec +++ b/tcl.spec @@ -50,6 +50,7 @@ Source2: baselibs.conf Source3: macros.tcl Patch0: tcl-refchan-mode-needed.patch Patch1: tcl-string-compare.patch +Patch2: tcl-interp-limit-time.patch BuildRequires: autoconf BuildRequires: pkg-config BuildRequires: zlib-devel @@ -95,6 +96,7 @@ if ! test -d pkgs/itcl%itclver; then fi %patch0 %patch1 +%patch2 # The SQLite extension is provided by the sqlite3 package, # so don't build it here.