Skip to content
Tcl Source Code View Ticket
Login

View Ticket

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

Inconsistent behaviour with env array on Windows

Closed / Fixedb492c33154cda419be5400f0018b5599cca96ae2Created 210 days agoUpdated 196 days ago
Descriptionmarkdown2026-05-06 15:59:34

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
Referenced by5
  • a4de0dcbabClosed ticket [1758527fff]: env bug on platform windows plus 4 other changes ticket2026-10-21 09:58:25
  • 2ae307305bMerge 9.0 - Fix [b492c33154] - info exists env(xxx) and set env(xxx) are inconsistent after setting to empty string check-in2026-05-21 08:10:56
  • 8e0656d976Fix [b492c33154] - info exists env(xxx) and set env(xxx) are inconsistent after setting to empty string check-in2026-05-21 08:07:56
  • ff71d077d6Fix [b492c33154] - fix [info exists] and [set] inconsistency for env on Windows check-in2026-05-21 08:03:12
  • 8e4061a167Bug [b492c33154] - info exists env(xxx) and set env(xxx) are inconsistent after setting to empty string on Windows check-in2026-05-20 08:02:31
apnadkarni Ticket [b492c33154]: 3 changes [History diff]2026-05-06 17:00:22
chwplain2026-05-13 20:24:20
How about the approach in the attached diff?
apnadkarniplain2026-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.)
chwplain2026-05-14 15:38:00
Howdy Ashok, NP, take your time for real important work. This issue isn't pressing at all.
apnadkarnimarkdown2026-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

chwplain2026-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.
apnadkarniplain2026-05-21 08:16:12
Fixed in [8e0656d976] for 9.0.4
Log in (anonymous is fine) to add a comment.

Attachments: