Tcl Source Code

View Ticket
Login
Ticket UUID: 3602289
Title: EnvTraceProc errors when env var doesn't exist
Type: Bug Created on: 2013-01-27 16:56:10
Submitter: pooryorick Assigned to: jan.nijtmans
Subsystem: 08. Environment Variables Severity: Minor
Priority: 5 Medium Last modified: 2026-10-20 10:20:23
Status: Closed Closed by: jan.nijtmans
Resolution: Duplicate Closed on: 2026-10-20 10:20:23
Version: 8.6.18, 9.0.5, 9.1.0
Description:
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
User Comments:
pooryorick added on 2013-01-27 23:56:11:

File Added - 459745: tclEnvTraceProc.diff

serhiy.storchaka added on 2026-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.nijtmans added on 2026-10-20 10:20:23:

Dup of [845241ffff]


Attachments: