Tcl Source Code

View Ticket
Login
Ticket UUID: 6235d23a7619cdabe706e09fa77421536c42b3ec
Title: Inconsistent handling of environment variables with [interp create]
Type: Bug Version: 8.6.11
Submitter: erikleunissen Created on: 2021-06-19 19:06:02
Subsystem: 08. Environment Variables Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2021-07-18 12:05:02
Resolution: None Closed By: nobody
    Closed on:
Description:
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
User Comments: erikleunissen added on 2021-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

Attachments: