Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2021-07-18
12:05 • Ticket [6235d23a76] Inconsistent handling of environment variables with [interp ... artifact: 474f250309 user: erikleunissen
2021-06-19
19:06 • Add attachment exercise.tcl to ticket [6235d23a76] artifact: 1d37ef4da5 user: erikleunissen
19:06 • New ticket [6235d23a76] Inconsistent handling of environment variables with [int... artifact: 9780fe0bb1 user: erikleunissen

Inconsistent handling of environment variables with [interp create]

Open6235d23a7619cdabe706e09fa77421536c42b3ecCreated 5 years agoUpdated 5 years ago
Descriptionplain2021-06-19 19:06:02
When creating a child interpreter, environment variables are handled differently between Linux and Windows. While I find the behaviour under Linux logical, I don't understand the behaviour under Windows, especially the fact that creation of a child interpreter affects the environment variables in the parent interpreter.

The attached file exercise.tcl demonstrates the issue when I run it under the two mentioned OS's. My observations:

> tclsh exercise.tcl
unix
1
0
0
0

> tclsh exercise.tcl
windows
1
0
1
1
erikleunissenplain2021-07-18 12:05:02
I believe that this is more severe than "Minor". So I take the liberty to increase the severity level. Also, making the questionable behaviour under windows more conspicuous by presenting it here in the ticket body (instead of an attachment).

% set tcl_platform(platform)
windows
% info exists env(HOME)
1
% unset env(HOME)
% info exists env(HOME)
0
% interp create child
child
interp eval child {info exists env(HOME)}
1
% info exists env(HOME)
1
Log in (anonymous is fine) to add a comment.