Skip to content
Tcl Source Code History Of Ticket 1758527fffffffffffffffffffffffffffffffff
Login

History Of Ticket 1758527fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 1758527fffffffffffffffffffffffffffffffff

  1. Ticket change [3f7cdfe093] (rid 121466) by exgerhardr on 2007-07-22 18:08:34:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      test procedure:
      -----------------------------------------
      % set env(Test) "Value"
      Value
      % info exists env(Test)
      1
      % puts $env(Test)
      Value
      % set env(Test) ""
      % info exists env(Test)
      1
      % puts $env(Test)
      can't read "env(Test)": no such variable
      -----------------------------------------
      
      [info exists ..] returns 1 but the variable cannot be dereferenced.
      
      % puts $tcl_patchLevel
      8.4.13
      % parray tcl_platform
      tcl_platform(byteOrder) = littleEndian
      tcl_platform(machine)   = intel
      tcl_platform(os)        = Windows NT
      tcl_platform(osVersion) = 5.0
      tcl_platform(platform)  = windows
      
      Same on Windows XP (Windows NT 5.1) with TCL 8.4.11,
      no problem on Linux and Unix (AIX), "" is returned.
      
      additional infos from comp.lang.tcl
      ========================================
       Still stranger: when you do an "array names env" before "info exists
      env(Test)" it vanishes in TCL.
      
      (bin) 38 % info patchlevel
      8.4.13
      (bin) 39 % set env(Test) "X"
      X
      (bin) 40 % info exists env(Test)
      1
      (bin) 41 % set env(Test) ""
      (bin) 42 % info exists env(Test)
      1
      (bin) 43 % array names env
      HOME PROCESSOR_IDENTIFIER ComSpec DEVMGR_SHOW_DETAILS
      DEVMGR_SHOW_NONPRESENT_DEVICES JSERV HOMEDRIVE ALLUSERSPROFILE
      FP_NO_HOST_CHECK SESSIONNAME PROCESSOR_REVISION PATHEXT LOGONSERVER
      VS80COMNTOOLS USERDOMAIN PROCESSOR_LEVEL DEFAULT_CA_NR USERPROFILE
      USERNAME COMPUTERNAME TREECTRL_LIBRARY TMP SystemRoot
      PROCESSOR_ARCHITECTURE OS ProgramFiles APPDATA CommonProgramFiles
      WV_GATEWAY_CFG windir Path TEMP HOMEPATH VU_LIBRARY SystemDrive
      PERL5LIB NUMBER_OF_PROCESSORS
      (bin) 44 % info exists env(Test)
      0
      (bin) 45 %
      ========================================
      So it seems that [array names] does some magic when the array in
      question is 'env' - namely unsetting the internal 'env' array and then
      re-populating it by asking Windows for all existing environment
      variables - et voilĂ  they're both in sync again.
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "exgerhardr"
    10. subsystem initialized to: "08. Environment Variables"
    11. title initialized to: "env bug on platform windows"
    12. type initialized to: "Bug"
  2. Ticket change [51ace37e7c] (rid 126172) by hobbs on 2008-01-14 08:01:26:

    1. icomment:
      Logged In: YES 
      user_id=72656
      Originator: NO
      
      This problem is rooted in Windows magic handling of setting an env var to "" to mean unsetting it.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  3. Ticket change [c307e52806] (rid 111587) by davygrvy on 2008-01-18 07:08:40:

    1. icomment:
      Logged In: YES 
      user_id=7549
      Originator: NO
      
      Like Jeff says, empty is unfortunately unset on win, too, which due to (possibly over agressive) internal array caching leaves Tcl thinking it's still there.
      
      Kinda reminds me of the file case issue where 'Readme.txt' is still the same file as 'readme.txt' which makes programs like CVS have a cow when the repository is hosted on a unix box where the two filenames are different files and the client is on win trying to overwrite and complaining about it: 'C move Readme.txt, it is in the way'.
      
      Jeff, is it possible that the internal caching could be bypassed for more accurate results?
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  4. Ticket change [bc8c52ccb0] (rid 182873) by Busirane on 2020-04-30 16:12:02:

    1. assignee changed to: "aku"
    2. closer changed to: "nobody"
    3. comment changed to:
      test procedure:
      -----------------------------------------
      % set env(Test) "Value"
      Value
      % info exists env(Test)
      1
      % puts $env(Test)
      Value
      % set env(Test) ""
      % info exists env(Test)
      1
      % puts $env(Test)
      can't read "env(Test)": no such variable
      -----------------------------------------
      
      [info exists ..] returns 1 but the variable cannot be dereferenced.
      
      % puts $tcl_patchLevel
      8.4.13
      % parray tcl_platform
      tcl_platform(byteOrder) = littleEndian
      tcl_platform(machine)   = intel
      tcl_platform(os)        = Windows NT
      tcl_platform(osVersion) = 5.0
      tcl_platform(platform)  = windows
      
      Same on Windows XP (Windows NT 5.1) with TCL 8.4.11,
      no problem on Linux and Unix (AIX), "" is returned.
      
      additional infos from comp.lang.tcl
      ========================================
       Still stranger: when you do an "array names env" before "info exists
      env(Test)" it vanishes in TCL.
      
      (bin) 38 % info patchlevel
      8.4.13
      (bin) 39 % set env(Test) "X"
      X
      (bin) 40 % info exists env(Test)
      1
      (bin) 41 % set env(Test) ""
      (bin) 42 % info exists env(Test)
      1
      (bin) 43 % array names env
      HOME PROCESSOR_IDENTIFIER ComSpec DEVMGR_SHOW_DETAILS
      DEVMGR_SHOW_NONPRESENT_DEVICES JSERV HOMEDRIVE ALLUSERSPROFILE
      FP_NO_HOST_CHECK SESSIONNAME PROCESSOR_REVISION PATHEXT LOGONSERVER
      VS80COMNTOOLS USERDOMAIN PROCESSOR_LEVEL DEFAULT_CA_NR USERPROFILE
      USERNAME COMPUTERNAME TREECTRL_LIBRARY TMP SystemRoot
      PROCESSOR_ARCHITECTURE OS ProgramFiles APPDATA CommonProgramFiles
      WV_GATEWAY_CFG windir Path TEMP HOMEPATH VU_LIBRARY SystemDrive
      PERL5LIB NUMBER_OF_PROCESSORS
      (bin) 44 % info exists env(Test)
      0
      (bin) 45 %
      ========================================
      So it seems that [array names] does some magic when the array in
      question is 'env' - namely unsetting the internal 'env' array and then
      re-populating it by asking Windows for all existing environment
      variables - et voilĂ  they're both in sync again.
      
    4. icomment:
      Is this the same bug? The result changes with every other invocation. 
      The same thing happens with C?????? for COMSPEC and ComSpec. Notably, Path 
      and ComSpec are the two environment variables that are supposed to get 
      special treatment on Windows, by being uppercased. This causes problems with 
      tcltest 2.4.0 when cleanupTests tries to restore the environment array.
      
      (Desktop) 1 % array names env P???
      PATH Path
      (Desktop) 2 % array names env P???
      PATH
      (Desktop) 3 % array names env P???
      PATH Path
      (Desktop) 4 % array names env P???
      PATH
      (Desktop) 5 % info patchlevel
      8.6.6
      (Desktop) 6 % parray tcl_platform
      tcl_platform(byteOrder)     = littleEndian
      tcl_platform(engine)        = Tcl
      tcl_platform(machine)       = intel
      tcl_platform(os)            = Windows NT
      tcl_platform(osVersion)     = 10.0
      tcl_platform(pathSeparator) = ;
      tcl_platform(platform)      = windows
      tcl_platform(pointerSize)   = 4
      tcl_platform(threaded)      = 1
      tcl_platform(user)          = HTSP1395
      tcl_platform(wordSize)      = 4
      
    5. login: "Busirane"
    6. mimetype: "text/plain"
    7. severity changed to: "Minor"
    8. username: "Busirane"
  5. Ticket change [0b01047ce1] (rid 184047) by jan.nijtmans on 2020-06-21 17:17:18:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      I think this one is fixed already, but I'll double-check
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  6. Ticket change [7c8b5aa08e] (rid 184384) by jan.nijtmans on 2020-07-08 14:55:24:

    1. icomment:
      No, it's not fixed:
      <pre>
      >tclsh86.exe
      % set env(Test) "Value"
      Value
      % info exists env(Test)
      1
      % puts $env(Test)
      Value
      % set env(Test) ""
      % info exists env(Test)
      1
      % puts $env(Test)
      can't read "env(Test)": no such variable
      </pre>
      
      It looks like - on Windows - setting an environment variable to the empty string is the same as removing the environment variable. Not sure what we can do about this
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [28e67db084] (rid 184385) by jan.nijtmans on 2020-07-08 14:59:04:

    1. icomment:
      The other reported strange behavior is gone:
      <pre>
      % array names env P???
      PATH
      % array names env P???
      PATH
      % array names env P???
      PATH
      </pre>
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  8. Ticket change [a4de0dcbab] (rid 259684) by serhiy.storchaka on 2026-10-21 09:58:25:

    1. icomment:
      Duplicate of [b492c33154], fixed in 9.0.4 and 9.1.0 by [8e0656d976] / [2ae307305b]: on Windows, setting an env element to "" now removes it from the array too. 8.6 is unchanged.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Duplicate"
    5. status changed to: "Closed"
  9. Ticket change [3e54d35678] (rid 259983) by serhiy.storchaka on 2026-10-22 17:19:29:

    1. closedate changed to: "2461334.915567882"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"