diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-11-21 09:24:59 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-11-21 09:24:59 (GMT) |
commit | cb9a7e6abbfcd2e3a2613ffabf1f65518e03c403 (patch) | |
tree | d34a7e05781d7862cf2f193fe9488c59c475846a /library | |
parent | 6a3d5140e51ad5e33290aca9a36027e44ccabb66 (diff) | |
parent | 2254dff19ede852c343b6cc357a840917e55b112 (diff) | |
download | tcl-cb9a7e6abbfcd2e3a2613ffabf1f65518e03c403.zip tcl-cb9a7e6abbfcd2e3a2613ffabf1f65518e03c403.tar.gz tcl-cb9a7e6abbfcd2e3a2613ffabf1f65518e03c403.tar.bz2 |
The only relyable way of changing environment variables to uppercase (e.g. env(ComSpec) to env(COMSPEC)) is unsetting the old one first. Long-standing bug, exposed by [219226].
Diffstat (limited to 'library')
-rw-r--r-- | library/init.tcl | 12 | ||||
-rw-r--r-- | library/tcltest/tcltest.tcl | 11 |
2 files changed, 7 insertions, 16 deletions
diff --git a/library/init.tcl b/library/init.tcl index 1ca6413..f63eedf 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -130,9 +130,9 @@ if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} { switch -- $u { COMSPEC - PATH { - if {![info exists env($u)]} { - set env($u) $env($p) - } + set temp $env($p) + unset env($p) + set env($u) $temp trace add variable env($p) write \ [namespace code [list EnvTraceProc $p]] trace add variable env($u) write \ @@ -142,11 +142,7 @@ if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} { } } if {![info exists env(COMSPEC)]} { - if {$tcl_platform(os) eq "Windows NT"} { - set env(COMSPEC) cmd.exe - } else { - set env(COMSPEC) command.com - } + set env(COMSPEC) cmd.exe } } InitWinEnv diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index d066a1b..4b94312 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -2495,14 +2495,6 @@ proc tcltest::cleanupTests {{calledFromAllFile 0}} { set changedEnv {} set removedEnv {} foreach index [array names ::env] { - if {[info exists originalEnv($index)]} { - if {$::env($index) != $originalEnv($index)} { - lappend changedEnv $index - set ::env($index) $originalEnv($index) - } - } - } - foreach index [array names ::env] { if {![info exists originalEnv($index)]} { lappend newEnv $index unset ::env($index) @@ -2512,6 +2504,9 @@ proc tcltest::cleanupTests {{calledFromAllFile 0}} { if {![info exists ::env($index)]} { lappend removedEnv $index set ::env($index) $originalEnv($index) + } elseif {$::env($index) ne $originalEnv($index)} { + lappend changedEnv $index + set ::env($index) $originalEnv($index) } } if {[llength $newEnv] > 0} { |