From b850dbfa83b00f784712983feeab4601f6d30fdd3d2da48fa4b043079dcdd2f2 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Tue, 8 Jan 2019 15:43:13 +0000 Subject: [PATCH] - Fix a regression in the handling of denormalized empty lists (tcl-expand-regression.patch, tcl#cc1e91552c). OBS-URL: https://build.opensuse.org/package/show/devel:languages:tcl/tcl?expand=0&rev=113 --- tcl-expand-regression.patch | 76 +++++++++++++++++++++++++++++++++++++ tcl.changes | 6 +++ tcl.spec | 4 +- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 tcl-expand-regression.patch diff --git a/tcl-expand-regression.patch b/tcl-expand-regression.patch new file mode 100644 index 0000000..09791d5 --- /dev/null +++ b/tcl-expand-regression.patch @@ -0,0 +1,76 @@ +Index: generic/tclExecute.c +================================================================== +--- generic/tclExecute.c ++++ generic/tclExecute.c +@@ -5235,12 +5235,16 @@ + } + #endif + + /* Every range of an empty list is an empty list */ + if (objc == 0) { +- TRACE_APPEND(("\n")); +- NEXT_INST_F(9, 0, 0); ++ /* avoid return of not canonical list (e. g. spaces in string repr.) */ ++ if (ListObjIsCanonical(valuePtr)) { ++ TRACE_APPEND(("\n")); ++ NEXT_INST_F(9, 0, 0); ++ } ++ goto emptyList; + } + + /* Decode index value operands. */ + + /* + +Index: tests/basic.test +================================================================== +--- tests/basic.test ++++ tests/basic.test +@@ -959,10 +959,16 @@ + lappend res [catch { run { {*}{error Hejsan} } } err] + lappend res $err + } -cleanup { + unset res t + } -result {0 10 1 Hejsan} ++ ++test basic-48.24.$noComp {expansion: empty not canonical list, regression test, bug [cc1e91552c]} -constraints $constraints -setup { ++ unset -nocomplain a ++} -body { ++ run {list [list {*}{ }] [list {*}[format %c 32]] [list {*}[set a { }]]} ++} -result [lrepeat 3 {}] -cleanup {unset -nocomplain a} + + } ;# End of noComp loop + + test basic-49.1 {Tcl_EvalEx: verify TCL_EVAL_GLOBAL operation} testevalex { + set ::x global + +Index: tests/lrange.test +================================================================== +--- tests/lrange.test ++++ tests/lrange.test +@@ -105,14 +105,24 @@ + list [lrange {a b c} -1 1] [lrange {a b c} -1+0 end-1] [lrange {a b c} -2 1] [lrange {a b c} -2+0 0+1] + } [lrepeat 4 {a b}] + test lrange-3.6 {compiled with calculated indices, end out of range (after end)} { + list [lrange {a b c} 1 end+1] [lrange {a b c} 1+0 2+1] [lrange {a b c} 1 end+1] [lrange {a b c} end-1 3+1] + } [lrepeat 4 {b c}] ++ ++test lrange-3.7a {compiled on empty not canonical list (with static and dynamic indices), regression test, bug [cc1e91552c]} { ++ list [lrange { } 0 1] [lrange [format %c 32] 0 1] [lrange [set a { }] 0 1] \ ++ [lrange { } 0-1 end+1] [lrange [format %c 32] 0-1 end+1] [lrange $a 0-1 end+1] ++} [lrepeat 6 {}] ++test lrange-3.7b {not compiled on empty not canonical list (with static and dynamic indices), regression test, bug [cc1e91552c]} { ++ set cmd lrange ++ list [$cmd { } 0 1] [$cmd [format %c 32] 0 1] [$cmd [set a { }] 0 1] \ ++ [$cmd { } 0-1 end+1] [$cmd [format %c 32] 0-1 end+1] [$cmd $a 0-1 end+1] ++} [lrepeat 6 {}] + + + # cleanup + ::tcltest::cleanupTests + return + + # Local Variables: + # mode: tcl + # End: + diff --git a/tcl.changes b/tcl.changes index a2f07b4..f3c22ca 100644 --- a/tcl.changes +++ b/tcl.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jan 8 15:39:33 UTC 2019 - Reinhard Max + +- Fix a regression in the handling of denormalized empty lists + (tcl-expand-regression.patch, tcl#cc1e91552c). + ------------------------------------------------------------------- Wed Dec 12 16:28:09 UTC 2018 - Reinhard Max diff --git a/tcl.spec b/tcl.spec index 1fa3403..5d91c3f 100644 --- a/tcl.spec +++ b/tcl.spec @@ -1,7 +1,7 @@ # # spec file for package tcl # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -41,6 +41,7 @@ Source0: ftp://ftp.tcl.tk/pub/tcl/tcl8_6/%{name}%{version}%{rrc}-src.tar. Source1: tcl-rpmlintrc Source2: baselibs.conf Source3: macros.tcl +Patch0: tcl-expand-regression.patch BuildRequires: autoconf BuildRequires: pkg-config BuildRequires: zlib-devel @@ -80,6 +81,7 @@ the Tcl language itself. %prep %setup -q -n %name%version +%patch0 %build cd unix