Skip to content
Tcl Source Code History Of Ticket 67fd4f973ac46efd
Login

History Of Ticket 67fd4f973ac46efd

Artifacts Associated With Ticket 67fd4f973ac46efd

  1. Ticket change [9dd3b3bc54] (rid 171673) by GrAnd on 2019-05-20 17:48:50:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      There are 2 interpreters main and slave.
      If I do <tt>"set ::env(FOO) bar"</tt>, it appears in both interps (<tt>"info exists ::env(FOO)"</tt> reports 1 and I can actually read the var.
      Then, if I do <tt>"unset ::env(FOO)"</tt> in any interp, this var fully disappears in that interp (<tt>"info exists ::env(FOO)"</tt> returns 0 and on read an error is generated). But, in another interp <tt>"info exists ::env(FOO)"</tt> still claims that the var exists (returns 1), but if I actually try to read that variable I get an error.
      
      Test script:
      <pre>
      #!/bin/bash
      #\
      exec tclsh "$0"
      
      puts "TCL version: [info patchlevel]\n"
      
      proc checkGlobal {name} {
        puts -nonewline "${::context}: exists: [expr {[info exists ::env($name)]?"YES":" NO"}]"
        puts "   |    read:  [expr {[catch {set ::env($name)} err]?"ERROR: $err":"OK"}]"
      }
      proc setGlobal {name} {
        set ::env($name) "Value"
        puts "${::context}: set"
      }
      proc unsetGlobal {name} {
        unset ::env($name)
        puts "${::context}: unset"
      }
      
      set context "GLOBAL"
      set name "SOME_DUMMY_VAR_GLOBAL"
      puts "Checking Interp ${context}|    var    $name"
      checkGlobal $name
      setGlobal   $name
      checkGlobal $name
      unsetGlobal $name
      checkGlobal $name
      puts ""
      
      set I [interp create]
      # alias 3 procs above from global space and create the same procs in slave interp
      foreach p {check set unset} {
        interp alias $I ${p}Global {} ${p}Global
        $I eval [subst {
          proc ${p}Slave [list [info args ${p}Global]] [list [info body ${p}Global]]
        }]
      }
      
      $I eval {
        proc checkBoth {name} {
          checkSlave  $name
          checkGlobal $name
        }
        
        set context "SLAVE "
        set name "SOME_DUMMY_VAR_SLAVE"
        puts "Checking Interp ${context}|    var    $name"
        checkBoth  $name
        puts ""
        setSlave    $name
        checkBoth   $name
        unsetSlave  $name
        checkBoth   $name
        puts ""
        setGlobal   $name
        checkBoth   $name
        unsetGlobal $name
        checkBoth   $name
        puts ""
        setSlave    $name
        checkBoth   $name
        puts "WORKAROUND: unset twice (in both interps)"
        unsetSlave  $name
        unsetGlobal $name
        checkBoth   $name
        puts ""
      }
      </pre>
      
      And the output of script above:
      <pre>
      TCL version: 8.7a1
      
      Checking Interp GLOBAL|    var    SOME_DUMMY_VAR_GLOBAL
      GLOBAL: exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_GLOBAL)": no such variable
      GLOBAL: set
      GLOBAL: exists: YES   |    read:  OK
      GLOBAL: unset
      GLOBAL: exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_GLOBAL)": no such variable
      
      Checking Interp SLAVE |    var    SOME_DUMMY_VAR_SLAVE
      SLAVE : exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
      GLOBAL: exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
      
      SLAVE : set
      SLAVE : exists: YES   |    read:  OK
      GLOBAL: exists: YES   |    read:  OK
      SLAVE : unset
      SLAVE : exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
      <span style="color: red;">GLOBAL: exists: YES   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable   <b><<<<<<<<<< ????</b></span>
      
      GLOBAL: set
      SLAVE : exists: YES   |    read:  OK
      GLOBAL: exists: YES   |    read:  OK
      GLOBAL: unset
      <span style="color: red;">SLAVE : exists: YES   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable   <b><<<<<<<<<< ????</b></span>
      GLOBAL: exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
      
      SLAVE : set
      SLAVE : exists: YES   |    read:  OK
      GLOBAL: exists: YES   |    read:  OK
      WORKAROUND: unset twice (in both interps)
      SLAVE : unset
      GLOBAL: unset
      SLAVE : exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
      GLOBAL: exists:  NO   |    read:  ERROR: can't read "::env(SOME_DUMMY_VAR_SLAVE)": no such variable
      </pre>
      
    5. foundin initialized to: "8.5.x, 8.6.x, 8.7.x"
    6. is_private initialized to: "0"
    7. login: "GrAnd"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "d2848f54ebf917fc6fb2a00b4ba4b2271563347e"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "GrAnd"
    14. subsystem initialized to: "17. Commands I-L"
    15. title initialized to:
      incorrect results of 'info exists' when unset env var in one interp and check for existence from another interp
      
    16. type initialized to: "Bug"
  2. Ticket change [1bb724274c] (rid 259322) by serhiy.storchaka on 2026-10-19 18:15:21:

    1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
    2. icomment:
      Still present in 8.6, 9.0 and 9.1. The env read trace returns an error for a name no longer in the environment, but keeps the stale element, so <nowiki>[info exists]</nowiki> still sees it. Proposed fix in branch [/timeline?r=env-stale-element|env-stale-element], together with [3602289fff] and [845241ffff]: the read trace removes the stale element. Test env-11.3.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"
  3. Ticket change [72d2c52686] (rid 259359) by jan.nijtmans on 2026-10-20 10:21:00:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2461333.9312567939"
    3. closer changed to: "jan.nijtmans"
    4. icomment: "Dup of [845241ffff]"
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Duplicate"
    8. status changed to: "Closed"