Tcl Source Code

View Ticket
Login
2026-10-21
09:58 • Closed ticket [1758527fff]: env bug on platform windows plus 4 other changes artifact: a4de0dcbab user: serhiy.storchaka
2026-05-21
08:16 • Closed ticket [b492c33154]: Inconsistent behaviour with env array on Windows... artifact: 980a7d3bd5 user: apnadkarni
08:10
Merge 9.0 - Fix [b492c33154] - info exists env(xxx) and set env(xxx) are inconsistent after setting ... check-in: 2ae307305b user: apnadkarni tags: trunk, main
08:07
Fix [b492c33154] - info exists env(xxx) and set env(xxx) are inconsistent after setting to empty str... check-in: 8e0656d976 user: apnadkarni tags: core-9-0-branch
08:03
Fix [b492c33154] - fix [info exists] and [set] inconsistency for env on Windows closed check-in: ff71d077d6 user: apnadkarni tags: mistake
03:44 • Ticket [b492c33154] Inconsistent behaviour with env array on Windows status ... artifact: e4a6efa392 user: chw
2026-05-20
08:06 • Ticket [b492c33154]: 3 changes artifact: 0d467872a7 user: apnadkarni
08:02
Bug [b492c33154] - info exists env(xxx) and set env(xxx) are inconsistent after setting to empty str... closed check-in: 8e4061a167 user: apnadkarni tags: bug-b492c33154
2026-05-14
15:38 • Ticket [b492c33154] Inconsistent behaviour with env array on Windows status ... artifact: 768e8b2c62 user: chw
10:39 • Ticket [b492c33154]: 3 changes artifact: f38f4643ef user: apnadkarni
2026-05-13
20:24 • Add attachment tclEnv.c-diff to ticket [b492c33154] artifact: fa521aa6e5 user: chw
20:24 • Ticket [b492c33154] Inconsistent behaviour with env array on Windows status ... artifact: 8d43d217d0 user: chw
2026-05-06
17:00 • Ticket [b492c33154]: 3 changes artifact: 8a115f5a74 user: apnadkarni
15:59 • New ticket [b492c33154]. artifact: 1eae5dcb01 user: apnadkarni

Ticket UUID: b492c33154cda419be5400f0018b5599cca96ae2
Title: Inconsistent behaviour with env array on Windows
Type: Bug Created on: 2026-05-06 15:59:34
Submitter: apnadkarni Assigned to: nobody
Subsystem: 08. Environment Variables Severity: Minor
Priority: 5 Medium Last modified: 2026-05-21 08:16:12
Status: Closed Closed by: apnadkarni
Resolution: Fixed Closed on: 2026-05-21 08:16:12
Version: 8.6
Description:

The following inconsistent behavior is seen on Windows. Setting an env variable to the empty string unsets it (as documented) but info exists thinks it is still defined.

% info exists env(TMP)
1
% set env(TMP)
D:\Temp
% set env(TMP) ""
% info exists env(TMP)
1
% set env(TMP)
can't read "env(TMP)": no such variable
User Comments:
chw added on 2026-05-13 20:24:20:
How about the approach in the attached diff?

apnadkarni added on 2026-05-14 10:39:54:
Thanks, Christian. I am a bit under the gun to get TIP's in before May 27. But will take a look after if no one else does.

(I'm presuming you do not have commit privileges yourself.)

chw added on 2026-05-14 15:38:00:
Howdy Ashok, NP, take your time for real important work. This issue isn't pressing at all.

apnadkarni added on 2026-05-20 08:06:52:

@chw, unfortunately, patch did not fix the problem. Instead, I'm now calling Tcl_UnsetVar2 which will invoke a recursive trace but I don't think that is a problem.

Proposed implementation in bug-b492c33154


chw added on 2026-05-21 03:44:55:
Ashok, I see, you're right. The unset will perform the real work of clearing out the environment variable in a second trace firing.

apnadkarni added on 2026-05-21 08:16:12:
Fixed in [8e0656d976] for 9.0.4

Attachments: