From 562da42399d8ca6235ac3bc1f49e7048d27bfcb1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 19 Aug 2025 15:05:34 +0000 Subject: Experimental simplification for platform on MacOS --- library/platform/platform.tcl | 101 +++++++++++------------------------------- 1 file changed, 26 insertions(+), 75 deletions(-) diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index 3bf1ff6..eb0e1dd 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -123,7 +123,12 @@ proc ::platform::generic {} { } } darwin { - set plat macosx + set major [lindex [split $tcl_platform(osVersion) .] 0] + if {$major > 15} { + set plat macos + } else { + set plat macosx + } # Correctly identify the cpu when running as a 64bit # process on a machine with a 32bit kernel if {$cpu eq "ix86"} { @@ -171,26 +176,28 @@ proc ::platform::identify {} { set id [generic] regexp {^([^-]+)-([^-]+)$} $id -> plat cpu - switch -- $plat { + switch -glob -- $plat { solaris { regsub {^5} $tcl_platform(osVersion) 2 text append plat $text return "${plat}-${cpu}" } - macosx { + macos* { set major [lindex [split $tcl_platform(osVersion) .] 0] - if {$major > 19} { - set minor [lindex [split $tcl_platform(osVersion) .] 1] - incr major 1 + incr major 1 + if {$major > 22} { if {$major < 26} { incr major -10 } + append plat $major + } elif {$major > 20} { + set minor [lindex [split $tcl_platform(osVersion) .] 1] if {$major < 14} { incr minor -1 } append plat $major.$minor } else { - incr major -4 + incr major -5 append plat 10.$major } return "${plat}-${cpu}" @@ -343,9 +350,9 @@ proc ::platform::patterns {id} { macosx-ix86 { lappend res macosx-universal macosx-i386-x86_64 } - macosx*-* { + macos*-* { # 10.5+,11.0+ - if {[regexp {macosx([^-]*)-(.*)} $id -> v cpu]} { + if {[regexp {macosx?([^-]*)-(.*)} $id -> v cpu]} { switch -exact -- $cpu { ix86 { @@ -366,76 +373,20 @@ proc ::platform::patterns {id} { } if {$v ne ""} { - foreach {major minor} [split $v .] break - + foreach {major minor} [split $v.5 .] break set res {} - if {$major > 26} { - # Add x.0 to x.minor to patterns. - for {set j $minor} {$j >= 0} {incr j -1} { - lappend res macosx${major}.${j}-${cpu} - foreach a $alt { - lappend res macosx${major}.${j}-$a - } + while {$major > 11} { + # Add $major to patterns. + lappend res macos${major}-${cpu} + foreach a $alt { + lappend res macos${major}-$a } incr major -1 - set minor 5; # Assume that (major-1).5 will be there one day. - } - if {$major eq 26} { - # Add 26.0 to 26.minor to patterns. - for {set j $minor} {$j >= 0} {incr j -1} { - lappend res macosx${major}.${j}-${cpu} - foreach a $alt { - lappend res macosx${major}.${j}-$a - } - } - set major 15 - set minor 6 - } - if {$major eq 15} { - # Add 15.0 to 15.minor to patterns. - for {set j $minor} {$j >= 0} {incr j -1} { - lappend res macosx${major}.${j}-${cpu} - foreach a $alt { - lappend res macosx${major}.${j}-$a - } - } - set major 14 - set minor 6 - } - if {$major eq 14} { - # Add 14.0 to 14.minor to patterns. - for {set j $minor} {$j >= 0} {incr j -1} { - lappend res macosx${major}.${j}-${cpu} - foreach a $alt { - lappend res macosx${major}.${j}-$a - } - } - set major 13 - set minor 5 - } - if {$major eq 13} { - # Add 13.0 to 13.minor to patterns. - for {set j $minor} {$j >= 0} {incr j -1} { - lappend res macosx${major}.${j}-${cpu} - foreach a $alt { - lappend res macosx${major}.${j}-$a - } - } - set major 12 - set minor 5 - } - if {$major eq 12} { - # Add 12.0 to 12.minor to patterns. - for {set j $minor} {$j >= 0} {incr j -1} { - lappend res macosx${major}.${j}-${cpu} - foreach a $alt { - lappend res macosx${major}.${j}-$a - } + if {$major == 25} { + set major 15 } - set major 11 - set minor 5 } - if {$major eq 11} { + if {$major == 11} { # Add 11.0 to 11.minor to patterns. for {set j $minor} {$j >= 0} {incr j -1} { lappend res macosx${major}.${j}-${cpu} @@ -465,7 +416,7 @@ proc ::platform::patterns {id} { lappend res macosx${major}.${j}-$a } } - # Add unversioned patterns for 10.3/10.4 builds. + # Add unversioned patterns for 10.3/10.4 builds. lappend res macosx-${cpu} foreach a $alt { lappend res macosx-$a -- cgit v0.12 From c7706471adbd05bf2150297c58e47b27dc2d5be7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 19 Aug 2025 21:48:16 +0000 Subject: Bug-fixing --- library/platform/platform.tcl | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index eb0e1dd..9bbc7be 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -184,13 +184,13 @@ proc ::platform::identify {} { } macos* { set major [lindex [split $tcl_platform(osVersion) .] 0] - incr major 1 - if {$major > 22} { + incr major + if {$major > 21} { if {$major < 26} { incr major -10 } append plat $major - } elif {$major > 20} { + } elseif {$major > 20} { set minor [lindex [split $tcl_platform(osVersion) .] 1] if {$major < 14} { incr minor -1 @@ -373,9 +373,9 @@ proc ::platform::patterns {id} { } if {$v ne ""} { - foreach {major minor} [split $v.5 .] break + foreach {major minor} [split $v.15 .] break set res {} - while {$major > 11} { + while {$major > 10} { # Add $major to patterns. lappend res macos${major}-${cpu} foreach a $alt { @@ -386,17 +386,6 @@ proc ::platform::patterns {id} { set major 15 } } - if {$major == 11} { - # Add 11.0 to 11.minor to patterns. - for {set j $minor} {$j >= 0} {incr j -1} { - lappend res macosx${major}.${j}-${cpu} - foreach a $alt { - lappend res macosx${major}.${j}-$a - } - } - set major 10 - set minor 15 - } # Add 10.9 to 10.minor to patterns. for {set j $minor} {$j >= 9} {incr j -1} { if {$cpu ne "arm"} { -- cgit v0.12 From 17a2efee72c4624cd964a07d8e18dca02c985f20 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Aug 2025 21:53:34 +0000 Subject: Keep all macos < 11 handling as it was --- library/platform/platform.tcl | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index 9bbc7be..d188a5e 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -124,7 +124,7 @@ proc ::platform::generic {} { } darwin { set major [lindex [split $tcl_platform(osVersion) .] 0] - if {$major > 15} { + if {$major > 19} { set plat macos } else { set plat macosx @@ -184,20 +184,14 @@ proc ::platform::identify {} { } macos* { set major [lindex [split $tcl_platform(osVersion) .] 0] - incr major - if {$major > 21} { + if {$major > 19} { + incr major if {$major < 26} { incr major -10 } append plat $major - } elseif {$major > 20} { - set minor [lindex [split $tcl_platform(osVersion) .] 1] - if {$major < 14} { - incr minor -1 - } - append plat $major.$minor } else { - incr major -5 + incr major -4 append plat 10.$major } return "${plat}-${cpu}" -- cgit v0.12 From 905f8b73d720bf9b2bff9c36d225236cf7735778 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 21 Aug 2025 14:00:13 +0000 Subject: Add testcases --- tests/platform.test | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/platform.test b/tests/platform.test index 33aea3a..e11b72d 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -34,7 +34,6 @@ test platform-1.0 {tcl_platform(engine)} { test platform-1.1 {TclpSetVariables: tcl_platform} { interp create i i eval {catch {unset tcl_platform(debug)}} - i eval {catch {unset tcl_platform(threaded)}} set result [i eval {lsort [array names tcl_platform]}] interp delete i set result @@ -72,6 +71,34 @@ test platform-4.2 {format of platform::generic result} -match regexp -body { platform::generic } -result {^([^-]+-)+[^-]+$} +test platform-5.0 {format of platform::generic result} -setup { + set old_machine $::tcl_platform(machine) + set old_os $::tcl_platform(os) + set old_wordsize $::tcl_platform(wordSize) + set old_version $tcl_platform(osVersion) + set ::tcl_platform(machine) arm + set ::tcl_platform(os) Darwin + set ::tcl_platform(wordSize) 8 +} -body { + set res {} + set l {macosx10.15-x86_64 macosx10.14-x86_64 macosx10.13-x86_64 macosx10.12-x86_64 macosx10.11-x86_64 macosx10.10-x86_64 macosx10.9-x86_64 tcl} + foreach v {20.0 21.0 22.0 23.0 24.0 25.0 26.0} { + set ::tcl_platform(osVersion) $v + set id [platform::identify] + set l [linsert $l 0 [string range $id 0 end-4]-x86_64] + set l [linsert $l 0 $id] + lappend res $id + lappend res [expr {($l eq [platform::patterns $id]) ? 1 : [platform::patterns $id]}] + } + set res +} -cleanup { + set ::tcl_platform(machine) $old_machine + set ::tcl_platform(os) $old_os + set ::tcl_platform(wordSize) $old_wordsize + set ::tcl_platform(osVersion) $old_version + unset res l old_machine old_os old_wordsize old_version +} -result {macos11-arm 1 macos12-arm 1 macos13-arm 1 macos14-arm 1 macos15-arm 1 macos26-arm 1 macos27-arm 1} + # cleanup cleanupTests -- cgit v0.12 From 4ee7135c5a85552878d7f4f21786d0b17d5bad77 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 21 Aug 2025 14:15:40 +0000 Subject: Line no longer needed --- tests/platform.test | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/platform.test b/tests/platform.test index e11b72d..1b49b40 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -33,7 +33,6 @@ test platform-1.0 {tcl_platform(engine)} { test platform-1.1 {TclpSetVariables: tcl_platform} { interp create i - i eval {catch {unset tcl_platform(debug)}} set result [i eval {lsort [array names tcl_platform]}] interp delete i set result -- cgit v0.12 From 65b29252affc1999b4c72236b728b848e7a732f5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 22 Aug 2025 12:50:28 +0000 Subject: Fix handling of i386-x86_64 --- library/platform/platform.tcl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index d188a5e..97bf815 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -348,13 +348,14 @@ proc ::platform::patterns {id} { # 10.5+,11.0+ if {[regexp {macosx?([^-]*)-(.*)} $id -> v cpu]} { + foreach {major minor} [split $v.15 .] break switch -exact -- $cpu { ix86 { lappend alt i386-x86_64 lappend alt universal } x86_64 { - if {[lindex [split $::tcl_platform(osVersion) .] 0] < 19} { + if {$major < 11 && $minor < 15} { set alt i386-x86_64 } else { set alt {} @@ -367,7 +368,6 @@ proc ::platform::patterns {id} { } if {$v ne ""} { - foreach {major minor} [split $v.15 .] break set res {} while {$major > 10} { # Add $major to patterns. @@ -385,6 +385,9 @@ proc ::platform::patterns {id} { if {$cpu ne "arm"} { lappend res macosx${major}.${j}-${cpu} } + if {($cpu eq "x86_64") && ($j == 14)} { + set alt i386-x86_64 + } foreach a $alt { lappend res macosx${major}.${j}-$a } -- cgit v0.12 From dace3996715c6a8f97b7c0a89e849df13c2be5f9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 22 Aug 2025 13:06:31 +0000 Subject: Add testcases for platform macos26-x86_64 and macos26-arm --- tests/platform.test | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/platform.test b/tests/platform.test index 1b49b40..5833a9f 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -97,6 +97,12 @@ test platform-5.0 {format of platform::generic result} -setup { set ::tcl_platform(osVersion) $old_version unset res l old_machine old_os old_wordsize old_version } -result {macos11-arm 1 macos12-arm 1 macos13-arm 1 macos14-arm 1 macos15-arm 1 macos26-arm 1 macos27-arm 1} +test platform-5.1 {format of platform::patterns macos26-x86_64} -body { + platform::patterns macos26-x86_64 +} -result {macos26-x86_64 macos15-x86_64 macos14-x86_64 macos13-x86_64 macos12-x86_64 macos11-x86_64 macosx10.15-x86_64 macosx10.14-x86_64 macosx10.14-i386-x86_64 macosx10.13-x86_64 macosx10.13-i386-x86_64 macosx10.12-x86_64 macosx10.12-i386-x86_64 macosx10.11-x86_64 macosx10.11-i386-x86_64 macosx10.10-x86_64 macosx10.10-i386-x86_64 macosx10.9-x86_64 macosx10.9-i386-x86_64 tcl} +test platform-5.2 {format of platform::patterns macos26-arm} -body { + platform::patterns macos26-arm +} -result {macos26-arm macos26-x86_64 macos15-arm macos15-x86_64 macos14-arm macos14-x86_64 macos13-arm macos13-x86_64 macos12-arm macos12-x86_64 macos11-arm macos11-x86_64 macosx10.15-x86_64 macosx10.14-x86_64 macosx10.13-x86_64 macosx10.12-x86_64 macosx10.11-x86_64 macosx10.10-x86_64 macosx10.9-x86_64 tcl} # cleanup cleanupTests -- cgit v0.12 From 535d9351df50c446d68d2a5b243b4cbbfb5aa666 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 25 Aug 2025 08:51:05 +0000 Subject: Fix handling of i386-x86_64 in platform extension. Add testcases for this (and other) situation --- library/platform/platform.tcl | 10 ++++++---- tests/platform.test | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index 3bf1ff6..e93e2df 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -347,13 +347,14 @@ proc ::platform::patterns {id} { # 10.5+,11.0+ if {[regexp {macosx([^-]*)-(.*)} $id -> v cpu]} { + foreach {major minor} [split $v.15 .] break switch -exact -- $cpu { ix86 { lappend alt i386-x86_64 lappend alt universal } x86_64 { - if {[lindex [split $::tcl_platform(osVersion) .] 0] < 19} { + if {$major < 11 && $minor < 15} { set alt i386-x86_64 } else { set alt {} @@ -366,8 +367,6 @@ proc ::platform::patterns {id} { } if {$v ne ""} { - foreach {major minor} [split $v .] break - set res {} if {$major > 26} { # Add x.0 to x.minor to patterns. @@ -451,6 +450,9 @@ proc ::platform::patterns {id} { if {$cpu ne "arm"} { lappend res macosx${major}.${j}-${cpu} } + if {($cpu eq "x86_64") && ($j == 14)} { + set alt i386-x86_64 + } foreach a $alt { lappend res macosx${major}.${j}-$a } @@ -465,7 +467,7 @@ proc ::platform::patterns {id} { lappend res macosx${major}.${j}-$a } } - # Add unversioned patterns for 10.3/10.4 builds. + # Add unversioned patterns for 10.3/10.4 builds. lappend res macosx-${cpu} foreach a $alt { lappend res macosx-$a diff --git a/tests/platform.test b/tests/platform.test index faab6d9..9ef0b9c 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -4,7 +4,7 @@ # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # -# Copyright (c) 1999 by Scriptics Corporation +# Copyright (c) 1999 Scriptics Corporation # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -78,6 +78,38 @@ test platform-4.2 {format of platform::generic result} -match regexp -body { platform::generic } -result {^([^-]+-)+[^-]+$} +test platform-5.0 {format of platform::generic result} -setup { + set old_machine $::tcl_platform(machine) + set old_os $::tcl_platform(os) + set old_wordsize $::tcl_platform(wordSize) + set old_version $tcl_platform(osVersion) + set ::tcl_platform(machine) arm + set ::tcl_platform(os) Darwin + set ::tcl_platform(wordSize) 8 + set ::tcl_platform(osVersion) 20.1 +} -body { + set res {} + set l {macosx10.15-x86_64 macosx10.14-x86_64 macosx10.13-x86_64 macosx10.12-x86_64 macosx10.11-x86_64 macosx10.10-x86_64 macosx10.9-x86_64 tcl} + set id [platform::identify] + set l [linsert $l 0 [string range $id 0 end-3]-x86_64] + set l [linsert $l 0 $id] + lappend res $id + lappend res [platform::patterns $id] + set res +} -cleanup { + set ::tcl_platform(machine) $old_machine + set ::tcl_platform(os) $old_os + set ::tcl_platform(wordSize) $old_wordsize + set ::tcl_platform(osVersion) $old_version + unset res l old_machine old_os old_wordsize old_version +} -result {macosx11.0-arm {macosx11.0-arm macosx11.0-x86_64 macosx10.15-x86_64 macosx10.14-x86_64 macosx10.13-x86_64 macosx10.12-x86_64 macosx10.11-x86_64 macosx10.10-x86_64 macosx10.9-x86_64 macosx10.8-x86_64 macosx10.7-x86_64 macosx10.6-x86_64 macosx10.5-x86_64 macosx-arm macosx-x86_64 tcl}} +test platform-5.1 {format of platform::patterns macosx11.0-x86_64} -body { + platform::patterns macosx11.0-x86_64 +} -result {macosx11.0-x86_64 macosx10.15-x86_64 macosx10.14-x86_64 macosx10.14-i386-x86_64 macosx10.13-x86_64 macosx10.13-i386-x86_64 macosx10.12-x86_64 macosx10.12-i386-x86_64 macosx10.11-x86_64 macosx10.11-i386-x86_64 macosx10.10-x86_64 macosx10.10-i386-x86_64 macosx10.9-x86_64 macosx10.9-i386-x86_64 macosx10.8-x86_64 macosx10.8-i386-x86_64 macosx10.7-x86_64 macosx10.7-i386-x86_64 macosx10.6-x86_64 macosx10.6-i386-x86_64 macosx10.5-x86_64 macosx10.5-i386-x86_64 macosx-x86_64 macosx-i386-x86_64 tcl} +test platform-5.2 {format of platform::patterns macosx11.0-arm} -body { + platform::patterns macosx11.0-arm +} -result {macosx11.0-arm macosx11.0-x86_64 macosx10.15-x86_64 macosx10.14-x86_64 macosx10.13-x86_64 macosx10.12-x86_64 macosx10.11-x86_64 macosx10.10-x86_64 macosx10.9-x86_64 macosx10.8-x86_64 macosx10.7-x86_64 macosx10.6-x86_64 macosx10.5-x86_64 macosx-arm macosx-x86_64 tcl} + # cleanup cleanupTests -- cgit v0.12 From d284f9118b547ed5cbe61bbe0ee9b683198104c8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 25 Aug 2025 11:42:28 +0000 Subject: Remove some more references to non-existing Tcl version 8.7 --- library/tcltest/tcltest.tcl | 4 ++-- tests/safe-stock.test | 4 ++-- tests/string.test | 20 ++++++-------------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index a2a4ae8..ab3b354 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -30,7 +30,7 @@ namespace eval tcltest { variable patchLevel [info patchlevel] # Detect if we can use code points >= \U10000 - variable fullutf [package vsatisfies $version 8.7-] + variable fullutf [package vsatisfies $version 9.0-] ##### Export the public tcltest procs; several categories # @@ -3330,7 +3330,7 @@ proc tcltest::viewFile {name {directory ""}} { # construct improperly formed strings in this manner, because it involves # exposing that Tcl uses UTF-8 internally. # -# This function doesn't work any more in Tcl 8.7, since the 'identity' +# This function doesn't work any more in Tcl 9.0, since the 'identity' # is gone (TIP #345) # # Arguments: diff --git a/tests/safe-stock.test b/tests/safe-stock.test index 0bab25d..3ab175d 100644 --- a/tests/safe-stock.test +++ b/tests/safe-stock.test @@ -3,7 +3,7 @@ # This file contains tests for safe Tcl that were previously in the file # safe.test, and use files and packages of stock Tcl 8.6 to perform the tests. # These files may be changed or disappear in future revisions of Tcl, -# for example package http 1.0 will be removed from Tcl 8.7. +# for example package http 1.0 will be removed from Tcl 9.0. # # The tests are replaced in safe.tcl with tests that use files provided in the # tests directory. Test numbering is for comparison with similar tests in @@ -13,7 +13,7 @@ # No output means no errors were found. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. -# Copyright (c) 1998-1999 by Scriptics Corporation. +# Copyright (c) 1998-1999 Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/tests/string.test b/tests/string.test index 7a44f98..dff10e9 100644 --- a/tests/string.test +++ b/tests/string.test @@ -22,9 +22,9 @@ catch [list package require -exact Tcltest [info patchlevel]] # Some tests require the testobj command -testConstraint testobj [expr {[info commands testobj] != {}}] -testConstraint testindexobj [expr {[info commands testindexobj] != {}}] -testConstraint testevalex [expr {[info commands testevalex] != {}}] +testConstraint testobj [expr {[info commands testobj] ne {}}] +testConstraint testindexobj [expr {[info commands testindexobj] ne {}}] +testConstraint testevalex [expr {[info commands testevalex] ne {}}] testConstraint utf16 [expr {[string length \U010000] == 2}] testConstraint testbytestring [llength [info commands testbytestring]] @@ -172,11 +172,7 @@ test string-2.36.$noComp {string compare, binary neq unequal length} { run {string compare [binary format a20a 0 1] [binary format a100a 0 0]} } 1 test string-2.37.$noComp {string compare, big -length} { - if {[package vsatisfies [info patchlevel] 8.7-]} { - run {string compare -length 0x100000000 ab abde} - } else { - run {string compare -length 0x7fffffff ab abde} - } + run {string compare -length 0x7fffffff ab abde} } -1 test string-2.38a.$noComp {string compare empty string against byte array} { # Bug edb4b065f4 @@ -343,11 +339,7 @@ test string-3.42.$noComp {string equal, binary neq inequal length} { run {string equal [binary format a20a 0 1] [binary format a100a 0 0]} } 0 test string-3.43.$noComp {string equal, big -length} { - if {[package vsatisfies [info patchlevel] 8.7-]} { - run {string equal -length 0x100000000 abc def} - } else { - run {string equal -length 0x7fffffff abc def} - } + run {string equal -length 0x7fffffff abc def} } 0 test string-3.44.$noComp {string equal, bigger -length} -body { run {string equal -length 18446744073709551616 abc def} @@ -456,7 +448,7 @@ test string-5.3.$noComp {string index} { run {string index abcde 0} } a test string-5.4.$noComp {string index} { - run {string in abcde 4} + run {string ind abcde 4} } e test string-5.5.$noComp {string index} { run {string index abcde 5} -- cgit v0.12 From 5860f82135ef9563e1dd60b1c00daeedb1767c7d Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 25 Aug 2025 16:42:09 +0000 Subject: amend to [0433b67adc] (ticket [87b69745be]): don't return with OK (swallow the error) if encoding cannot be loaded, and current system encoding is NULL for whatever reason --- generic/tclEncoding.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 43566ce..cbd2dc0 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -996,15 +996,15 @@ Tcl_SetSystemEncoding( ((Encoding *)encoding)->refCount += 1; } else { encoding = Tcl_GetEncoding(interp, name); + if (encoding == NULL) { + Tcl_MutexUnlock(&encodingMutex); + return TCL_ERROR; + } if (encoding == systemEncoding) { FreeEncoding(encoding); Tcl_MutexUnlock(&encodingMutex); return TCL_OK; } - if (encoding == NULL) { - Tcl_MutexUnlock(&encodingMutex); - return TCL_ERROR; - } } assert(encoding != systemEncoding); -- cgit v0.12 From 4478afff2aa58272cd2300927f054c710c4cc1c1 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 25 Aug 2025 22:55:02 +0000 Subject: fixes too earlier search for tcl-library (TclZipfsLocateTclLibrary shall be invoked after zipfs mount). --- generic/tclZipfs.c | 52 +++++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index bb27ae9..cd17306 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -6411,7 +6411,7 @@ ZipfsAppHookFindTclInit( if (zipfs_literal_tcl_library) { return TCL_ERROR; } - if (TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL)) { + if (TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL) != TCL_OK) { /* Either the file doesn't exist or it is not a zip archive */ return TCL_ERROR; } @@ -6553,17 +6553,19 @@ TclZipfs_AppHook( archive = Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); /* - * Look for init.tcl in one of the locations mounted later in this - * function. Errors ignored as other locations may be available. + * After mount, we'll look for init.tcl in one of the mounted locations. + * Thereby errors ignored as other locations may be available. */ - if (TclZipfsLocateTclLibrary() == TCL_OK) { - (void) TclZipfsInitEncodingDirs(); - } - if (!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { - int found; + if (TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL) == TCL_OK) { Tcl_Obj *vfsInitScript; + if (!zipfs_literal_tcl_library) { + if (TclZipfsLocateTclLibrary() == TCL_OK) { + (void) TclZipfsInitEncodingDirs(); + } + } + TclNewLiteralStringObj(vfsInitScript, ZIPFS_APP_MOUNT "/main.tcl"); Tcl_IncrRefCount(vfsInitScript); if (Tcl_FSAccess(vfsInitScript, F_OK) == 0) { @@ -6576,21 +6578,6 @@ TclZipfs_AppHook( Tcl_DecrRefCount(vfsInitScript); } - /* - * Set Tcl Encodings - */ - - if (!zipfs_literal_tcl_library) { - TclNewLiteralStringObj(vfsInitScript, - ZIPFS_APP_MOUNT "/tcl_library/init.tcl"); - Tcl_IncrRefCount(vfsInitScript); - found = Tcl_FSAccess(vfsInitScript, F_OK); - Tcl_DecrRefCount(vfsInitScript); - if (found == TCL_OK) { - zipfs_literal_tcl_library = ZIPFS_APP_MOUNT "/tcl_library"; - return result; - } - } #ifdef SUPPORT_BUILTIN_ZIP_INSTALL } else if (*argcPtr > 1) { /* @@ -6622,10 +6609,15 @@ TclZipfs_AppHook( Tcl_SetStartupScript(vfsInitScript, NULL); } return result; - } else if (!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { - int found; + } else if (TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL) == TCL_OK) { Tcl_Obj *vfsInitScript; + if (!zipfs_literal_tcl_library) { + if (TclZipfsLocateTclLibrary() == TCL_OK) { + (void) TclZipfsInitEncodingDirs(); + } + } + TclNewLiteralStringObj(vfsInitScript, ZIPFS_APP_MOUNT "/main.tcl"); Tcl_IncrRefCount(vfsInitScript); if (Tcl_FSAccess(vfsInitScript, F_OK) == 0) { @@ -6637,16 +6629,6 @@ TclZipfs_AppHook( } else { Tcl_DecrRefCount(vfsInitScript); } - /* Set Tcl Encodings */ - TclNewLiteralStringObj(vfsInitScript, - ZIPFS_APP_MOUNT "/tcl_library/init.tcl"); - Tcl_IncrRefCount(vfsInitScript); - found = Tcl_FSAccess(vfsInitScript, F_OK); - Tcl_DecrRefCount(vfsInitScript); - if (found == TCL_OK) { - zipfs_literal_tcl_library = ZIPFS_APP_MOUNT "/tcl_library"; - return result; - } } #ifdef _WIN32 Tcl_DStringFree(&ds); -- cgit v0.12