Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 92d4510eafd665f2ea507f6c0fbf0680bd558e2d
Ticket: 219209ffffffffffffffffffffffffffffffffff
setting env variable array is broken under Windows.
User & Date: nobody on 2000-10-26 05:03:37
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 3661 Bug
    Version: 8.2
    SubmitDate: '1999-11-23'
    LastModified: '2000-04-26'
    Severity: SER
    Status: Assigned
    Submitter: techsupp
    ChangedBy: hobbs
    RelatedBugIDs: 4109 1999
    OS: All Windows
    FixedDate: '2000-10-25'
    ClosedDate: '1999-11-24'
    
    
    Name:
    Mo DeJong
    
    Comments:
    I seem to remember a strange problem like this with Tcl 8.0. At the time,
    the problem was that after an env var was set a variable trace would get
    fired and the trace would delete an empty env var.
    
    ReproducibleScript:
    Setting an env variable to the empty string actually removes the variable
    from the env array under Windows. Here is a quick example.
    
    % set env(CLASSPATH) value
    % parray env
    env(BLASTER)    = A220 I5 D1 T4
    env(CLASSPATH)  = value
    env(CMDLINE)    = WIN
    ...
    
    % set env(CLASSPATH) ""
    % parray env
    env(BLASTER)    = A220 I5 D1 T4
    env(CMDLINE)    = WIN
    ... (no CLASSPATH key)
    
    ObservedBehavior:
    The env var is deleted when set to "".
    
    DesiredBehavior:
    I want to env var to be set properly.
    This same code works fine under Linux.
    
    
    This is the defined behavior of Windows env variables,
    but isn't acceptable because the following fails:
    
    if {! [info exists env(CLASSPATH)]} {
      set env(CLASSPATH) ""
    }
    set env(CLASSPATH) $env(CLASSPATH);C:\\dir
    
    The interim work-around is to do a read trace on the env
    array for Windows. 
    -- 11/24/1999 hobbs
    
    --
    
    What about:
    
    --------------------------------------
    set tmpClasspath ""
    if { [info exists env(CLASSPATH)] } {
    set tmpClasspath $env(CLASSPATH)
    }
    set tmpClasspath "$tmpClasspath;C:\\dir"
    ...
    set env(CLASSPATH) $tmpClasspath
    --------------------------------------
    
    This has the additional benefit of avoiding the overhead of working with the env array except when it's absolutely necessary.
    
    Removing environment variables when they are set to null is the normal behavior on Windows; I don't know if it is right to change that behavior.
    
    -- 04/10/2000 ericm 
    -- 04/26/2000 hobbs
    
    
    
  4. foundin changed to: "obsolete: 8.2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "07. Variables"
  10. title changed to:
    setting env variable array is broken under Windows.
    
  11. type changed to: "Bug"