Skip to content
Tcl Source Code View Ticket
Login

View Ticket

SetEnvironmentVariable() currupts list

Open502197ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 21 years ago
Descriptionplain2002-01-11 05:42:31
Win32 specific!

Use of SetEnvironmentVariable() by an extension or an 
application that embeds Tcl, puts the libc maintained 
environ list out-of-sync.  This in turn puts Tcl's env 
array out-of-sync as well.
hobbsplain2002-02-26 05:09:16
Logged In: YES 
user_id=72656

This is why Tcl has the Tcl_PutEnv compatibility procedure 
for extension authors to use to keep in sync.
davygrvyplain2002-02-26 05:16:32
Logged In: YES 
user_id=7549

but in places where this is out of your control, 
GetEnvironmentStrings() more accurately represents what the 
OS maintains.
davygrvyplain2004-01-03 16:39:34
Logged In: YES 
user_id=7549

This is not fixed, nor invalid.  reopening.
davygrvyplain2004-01-15 15:57:59
Logged In: YES 
user_id=7549

writing sync problems:

% tsetenv FOO baz
% wgetenv FOO
baz
% set env(FOO)
baz
% getenv FOO                          <- blank return
% wsetenv FOO pickle
% set env(FOO)
baz
% getenv FOO
%

reading sync prolems:

% set env(TEST) first
first
% load test
% set env(TEST) second
second
% getenv TEST
first
% wgetenv TEST
second
% tgetenv TEST
second
davygrvyplain2004-01-15 15:58:00
File Added - 73512: test.c
davygrvyplain2004-01-15 16:19:41
Logged In: YES 
user_id=7549

Just this, and everyone has the wrong answer:

% getenv FOO
% setenv FOO qwe
% set env(FOO)
baz
% wgetenv FOO
qwe
% tgetenv FOO
baz
% wsetenv FOO asd             <- system
% tgetenv FOO
baz                           <- tcl
% getenv FOO
qwe                           <- c-runtime
%
hobbsplain2005-10-05 15:10:19
Logged In: YES 
user_id=72656

Hmmm, I just corrected this for unix with 979640.  I'm not
sure how related they are, as we rely on putenv solely for
Windows.
davygrvy Ticket [502197ffff]: 1 change [History diff]2005-11-04 04:56:05
Log in (anonymous is fine) to add a comment.

Attachments: