|
2026-10-20
| ||
| 10:21 | • Closed ticket [67fd4f973a]: incorrect results of 'info exists' when unse... artifact: 72d2c52686 user: jan.nijtmans | |
|
2026-10-19
| ||
| 18:15 | • Ticket [845241ffff] Unsetting env vars in slave interps status still Open wi... artifact: c397ba3d05 user: serhiy.storchaka | |
| 18:15 | • Ticket [67fd4f973a] incorrect results of 'info exists' when unset env va... artifact: 1bb724274c user: serhiy.storchaka | |
| 18:15 | • Ticket [3602289fff] EnvTraceProc errors when env var doesn't exist statu... artifact: 133bdc6dae user: serhiy.storchaka | |
| 18:12 | Fix [3602289fff], [67fd4f973a] and [845241ffff]: after another interp unset an env variable, a read ... closed check-in: f1438aeb70 user: serhiy.storchaka tags: env-stale-element | |
|
2019-05-20
| ||
| 17:48 | • New ticket [67fd4f973a] incorrect results of 'info exists' when unset en... artifact: 9dd3b3bc54 user: GrAnd | |
incorrect results of 'info exists' when unset env var in one interp and check for existence from another interp
Test script:
#!/bin/bash #\ exec tclsh "$0"puts "TCL version: [info patchlevel]\n"
proc checkGlobal {name} { puts -nonewline "${::context}: exists: [expr {[info exists ::env($name)]?"YES":" NO"}]" puts " | read: [expr {[catch {set ::env($name)} err]?"ERROR: $err":"OK"}]" } proc setGlobal {name} { set ::env($name) "Value" puts "${::context}: set" } proc unsetGlobal {name} { unset ::env($name) puts "${::context}: unset" }
set context "GLOBAL" set name "SOME_DUMMY_VAR_GLOBAL" puts "Checking Interp ${context}| var $name" checkGlobal $name setGlobal $name checkGlobal $name unsetGlobal $name checkGlobal $name puts ""
set I [interp create] # alias 3 procs above from global space and create the same procs in slave interp foreach p {check set unset} { interp alias $I ${p}Global {} ${p}Global $I eval [subst { proc ${p}Slave [list [info args ${p}Global]] [list [info body ${p}Global]] }] }
$I eval { proc checkBoth {name} { checkSlave $name checkGlobal $name }
set context "SLAVE " set name "SOME_DUMMY_VAR_SLAVE" puts "Checking Interp ${context}| var $name" checkBoth $name puts "" setSlave $name checkBoth $name unsetSlave $name checkBoth $name puts "" setGlobal $name checkBoth $name unsetGlobal $name checkBoth $name puts "" setSlave $name checkBoth $name puts "WORKAROUND: unset twice (in both interps)" unsetSlave $name unsetGlobal $name checkBoth $name puts "" }
And the output of script above:
TCL version: 8.7a1Checking Interp GLOBAL| var SOME_DUMMY_VAR_GLOBAL GLOBAL: exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_GLOBAL)": no such variable GLOBAL: set GLOBAL: exists: YES | read: OK GLOBAL: unset GLOBAL: exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_GLOBAL)": no such variable
Checking Interp SLAVE | var SOME_DUMMY_VAR_SLAVE SLAVE : exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable GLOBAL: exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
SLAVE : set SLAVE : exists: YES | read: OK GLOBAL: exists: YES | read: OK SLAVE : unset SLAVE : exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable GLOBAL: exists: YES | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable <<<<<<<<<< ????
GLOBAL: set SLAVE : exists: YES | read: OK GLOBAL: exists: YES | read: OK GLOBAL: unset SLAVE : exists: YES | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable <<<<<<<<<< ???? GLOBAL: exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
SLAVE : set SLAVE : exists: YES | read: OK GLOBAL: exists: YES | read: OK WORKAROUND: unset twice (in both interps) SLAVE : unset GLOBAL: unset SLAVE : exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable GLOBAL: exists: NO | read: ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
c397ba3d05Ticket [845241ffff] Unsetting env vars in slave interps status still Open with 4 other changes ticket2026-10-19 18:15:22133bdc6daeTicket [3602289fff] EnvTraceProc errors when env var doesn't exist status still Open with 4 other changes ticket2026-10-19 18:15:21f1438aeb70Fix [3602289fff], [67fd4f973a] and [845241ffff]: after another interp unset an env variable, a read failed but left the old element, so [info exists ::env(X)] still returned 1. Remove the stale element in the read trace. check-in2026-10-19 18:12:43
Still present in 8.6, 9.0 and 9.1. The env read trace returns an error for a name no longer in the environment, but keeps the stale element, so [info exists] still sees it. Proposed fix in branch env-stale-element, together with [3602289fff] and [845241ffff]: the read trace removes the stale element. Test env-11.3.
Dup of [845241ffff]