Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e05145214f8980b7293acb7982de5c559d466c8c
Ticket: f3ee78aedbda6d61900893fe7f83cf0478ff1844
Env variables unset in slave appear to be defined but are not accessible by master
User & Date: kevin.bowen on 2014-04-04 19:51:46
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    One of our engineers encountered this issue a while ago on version 8.4.6 and worked around it with the following patch. We are submitting the fix back to the user community. The patch has been updated to reference version 8.6.1.
    
    ----- Patch -----
    atlgar-vdi0952[kbowen](~/workspace_remote/tcl8.6.1/generic)$ diff -du tclEnv.c.orig tclEnv.c
    --- tclEnv.c.orig       2013-09-19 15:04:14.000000000 -0400
    +++ tclEnv.c    2014-04-04 15:35:00.851155000 -0400
    @@ -565,6 +565,7 @@
            const char *value = TclGetEnv(name2, &valueString);
     
            if (value == NULL) {
    +           Tcl_UnsetVar2(interp, name1, name2, 0);
                return (char *) "no such variable";
            }
            Tcl_SetVar2(interp, name1, name2, value, 0);
    
    ----- Reproduction Script -----
    #! /bin/env tclsh
    
    set testEnvName USER
    
    set slave [interp create]
    
    puts "TCL Version = $tcl_version"
    puts "Defined to start - $testEnvName = $env($testEnvName)"
    
    # Execute a slave interp to unsetenv the variable
    $slave eval unset env($testEnvName)
    
    if { [info exists env($testEnvName)] == 1 } {
        # This will execute even when the environment variable has been unset.
        # This causes a de-reference error.
        puts "Still defined? - $testEnvName = $env($testEnvName)"
    } else {
        puts "Not defined - $testEnvName"
    }
    
    ----- Reproduction Output -----
    atlgar-vdi0952[kbowen](~/workspace_remote)$ ./tcl_problem
    TCL Version = 8.4
    Defined to start - USER = kbowen
    can't read "env(USER)": no such variable
        while executing
    "puts "Still defined? - $testEnvName = $env($testEnvName)""
        invoked from within
    "if { [info exists env($testEnvName)] == 1 } {
        # This will execute even when the environment variable has been unset.
        # This causes a de-refere..."
        (file "../../tcl_problem" line 13)
    
  5. foundin changed to: "8.6.1"
  6. is_private changed to: "0"
  7. login: "kevin.bowen"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "00ad10b7c04c674401b80f9628892d9486e49d6e"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "kevin.bowen"
  14. subsystem changed to: "08. Environment Variables"
  15. title changed to:
    Env variables unset in slave appear to be defined but are not accessible by master
    
  16. type changed to: "Bug"