Skip to content
Tcl Source Code View Ticket
Login

View Ticket

EnvTraceProc errors when env var doesn't exist

Closed / Duplicate3602289fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 44 days ago
Descriptionplain2013-01-27 16:56:10
EnvTraceProc returns a non-null pointer to an error string if the environment variable doesn't exist..  The attached patch, instead of returning an error, checks to see if the corresponding env element exists, and unsets it if it does.  With this changes, the test suite still passes for 8.5 and 8.6 (trunk).  This change is relevant to bug 3057639
Referenced by3
  • c397ba3d05Ticket [845241ffff] Unsetting env vars in slave interps status still Open with 4 other changes ticket2026-10-19 18:15:22
  • 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
  • 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
pooryorickplain2013-01-27 23:56:11
File Added - 459745: tclEnvTraceProc.diff
serhiy.storchakawiki2026-10-19 18:15:21

Still present in 8.6, 9.0 and 9.1 in a narrower form: after another interp unsets an env variable, reading it here fails, but the stale element stays, so [info exists ::env(X)] still returns 1. The lappend case no longer errors.

Proposed fix in branch env-stale-element, also for [67fd4f973a] and [845241ffff]: the read trace removes the stale element and keeps the error. Unlike the attached patch, [set env(missing)] still fails, and elements without a value are kept, since they may hold traces (env-7.3, [9b4702]). Tests env-11.1 to 11.3.

jan.nijtmanswiki2026-10-20 10:20:23

Dup of [845241ffff]

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

Attachments: