Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Blank environment variables on windows

Closed / Duplicate610658ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-09-17 16:59:49
MS Windows cannot deal with environment variables that 
are blank. It uses this as a way to unset them. I view this as 
a bug in Windows, but it does cause Tcl some headaches.

% set env(FOO) ""
% info exists env(FOO)
1
% puts env(FOO)
can't read "env(FOO)": no such variable
% parray env
# output of environment, not including FOO
% info exists env(FOO)
0
%

It appears that parray updates the env cache and so resets 
the array elements.
Under 8.3.1 this worked in as much as info exists env(FOO) 
would always yield 0 or a blank environment variable.

James
dkfplain2002-09-24 16:40:44
Logged In: YES 
user_id=79902

This is how environment variables are defined to operate on
Windows (which sucks, but that's been discussed before in
many closed-out bugs. Blame Microsoft. Really.)

Only possibly problem is that [info exists env(FOO)]
succeeded the first time.
jkbonfieldplain2002-09-24 17:26:31
Logged In: YES 
user_id=154581

The "Tcl headaches" as I put it was the real issue here; not the 
blank environment variables as I realise this is a windows bug.

Regarding labelling as duplicate - I agree. I should have 
searched more thorougly. BugID 488882 is an currently open bug 
specifically about info exists env() so I suggest this one is closed.
hobbsplain2002-11-18 06:24:48
Logged In: YES 
user_id=72656

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