Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-30
13:08 • Closed ticket [845241ffff]: Unsetting env vars in slave interps plus 9 other... artifact: d697a01f29 user: jan.nijtmans
13:07
Fix [845241]: Unsetting env vars in slave interps check-in: 86ce5ad9dd user: jan.nijtmans tags: core-8-6-branch
12:03
Fix [845241]: Unsetting env vars in slave interps check-in: ec3f6936f2 user: jan.nijtmans tags: core-9-0-branch
11:52
Fix [845241]: Unsetting env vars in slave interps check-in: 1f1167cd23 user: jan.nijtmans tags: trunk, main
2026-10-20
10:21 • Closed ticket [67fd4f973a]: incorrect results of 'info exists' when unse... artifact: 72d2c52686 user: jan.nijtmans
10:20 • Closed ticket [3602289fff]: EnvTraceProc errors when env var doesn't exist</... artifact: 6219c171da 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
2003-11-19
16:43 • New ticket [845241ffff] Unsetting env vars in slave interps. artifact: 81b56a0834 user: sbron

Unsetting env vars in slave interps

Closed / Fixed845241ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 33 days ago
Descriptionplain2003-11-19 16:43:19
When an evironment variable has been unset in a slave
interpreter it is left in some strange state:
- info exists reports the variable still exists
- set and $env report the variable doesn't exist
- using an upvar alias the variable still has its
original value

Tested on Linux 2.4.20 and windows 98.

Code to reproduce the problem (use some existing
environment variable):

puts $env(SHELL)
interp create i
i eval {unset env(SHELL)}
catch {set env(SHELL)} msg
puts $msg
puts [info exists env(SHELL)]
upvar 0 env(SHELL) foo
puts $foo
Referenced by5
  • 72d2c52686Closed ticket [67fd4f973a]: incorrect results of 'info exists' when unset env var in one interp and check for existence from another interp plus 7 other changes ticket2026-10-20 10:21:00
  • 6219c171daClosed ticket [3602289fff]: EnvTraceProc errors when env var doesn't exist plus 9 other changes ticket2026-10-20 10:20:23
  • 1bb724274cTicket [67fd4f973a] incorrect results of 'info exists' when unset env var in one interp and check for existence from another interp status still Open with 4 other changes ticket2026-10-19 18:15:21
  • 133bdc6daeTicket [3602289fff] EnvTraceProc errors when env var doesn't exist status still Open with 4 other changes ticket2026-10-19 18:15:21
  • f1438aeb70Fix [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
serhiy.storchakawiki2026-10-19 18:15:22

Still present in 8.6, 9.0 and 9.1: after a child interp unsets an env variable, [info exists env(X)] stays 1 in the parent. Proposed fix in branch env-stale-element, together with [3602289fff] and [67fd4f973a]: the read trace removes the stale element. Test env-11.1.

jan.nijtmanswiki2026-10-30 13:08:19

Fixed in [trunk], core-9-0-branch and core-8-6-branch

Many thanks!

Log in (anonymous is fine) to add a comment.