Skip to content
Tcl Source Code History Of Ticket 2806622
Login

History Of Ticket 2806622

Artifacts Associated With Ticket 2806622

  1. Ticket change [566321c667] (rid 94308) by rkeene on 2009-06-15 14:22:20:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      $tcl_platform(user) has garbage in it when run as "SYSTEM" in a Windows Domain "Startup" script.
      
      Tested on Tcl 8.5.1
      
    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: "rkeene"
    10. subsystem initialized to: "07. Variables"
    11. title initialized to:
      $tcl_platform(user) has garbage in sometimes on Win32
      
    12. type initialized to: "Bug"
  2. Ticket change [af7cdcb92c] (rid 97822) by mpc_janssen on 2009-06-29 19:49:44:

    1. icomment:
      This seems to be caused by the call to
          Tcl_WinTCharToUtf(szUserName, (int) dwUserNameLen, &ds);
      at tclWinInit.c line 581. This code only gets exercised if env(USERNAME) is empty.
      
      It seems that GetUserName doesn't return a TCHAR, but as simple char *
      
      
    2. login: "mpc_janssen"
    3. mimetype: "text/plain"
    4. username: "mpc_janssen"
  3. Ticket change [e17333419e] (rid 87449) by mpc_janssen on 2009-06-29 19:51:13:

    1. icomment:
      Note that this always fails if env(USERNAME) is not set:
      
      C:\src>set USERNAME
      Environment variable USERNAME not defined
      
      C:\src>c:\tcl\bin\tclsh85.exe
      % parray tcl_platform
      tcl_platform(byteOrder)   = littleEndian
      tcl_platform(machine)     = intel
      tcl_platform(os)          = Windows NT
      tcl_platform(osVersion)   = 5.1
      tcl_platform(platform)    = windows
      tcl_platform(pointerSize) = 4
      tcl_platform(threaded)    = 1
      tcl_platform(user)        = ???2
      tcl_platform(wordSize)    = 4
      
      
    2. login: "mpc_janssen"
    3. mimetype: "text/plain"
    4. username: "mpc_janssen"
  4. Ticket change [920680d110] (rid 120711) by mpc_janssen on 2009-06-29 19:55:49:

    1. icomment:
      replacing the line with:
      
              Tcl_ExternalToUtfDString(NULL,szUserName , (int)dwUserNameLen, &ds);
      
      fixes the issue.
      
      
    2. login: "mpc_janssen"
    3. mimetype: "text/plain"
    4. username: "mpc_janssen"
  5. Ticket change [2ef3ce0266] (rid 92972) by mpc_janssen on 2009-06-29 22:27:31:

    1. icomment:
      The line below was not quite correct:
      
      Correct is:
      Tcl_ExternalToUtfDString(NULL,szUserName , -1, &ds);
      
      And a test case demonstrating failure without change and correct result after:
      
      # Test that the username is set correctly
      
      test platform-4.1 {tcl_platform(username) matches the username (bug #2806622) } \
          -body {
              set username $::env(USERNAME)
              unset ::env(USERNAME)
              interp create user_name
              set result [user_name eval {set tcl_platform(user)}]
              interp delete user_name
              set ::env(USERNAME) $username
              expr  {$result eq $username} 
          } \
          -result 1
      
      
    2. login: "mpc_janssen"
    3. mimetype: "text/plain"
    4. username: "mpc_janssen"
  6. Ticket change [36eabda993] (rid 107184) by mpc_janssen on 2009-06-29 22:46:22:

    1. icomment:
      It's a bit trickier than it intially looks, using the External call doesn't work for user names with non-ascii chars
      
      
    2. login: "mpc_janssen"
    3. mimetype: "text/plain"
    4. username: "mpc_janssen"
  7. Ticket change [0709bf38af] (rid 89317) by patthoyts on 2009-06-30 21:29:07:

    1. icomment:
      
      
      File Added - 332938: getusername.patch
      
      
      
    2. login: "patthoyts"
    3. mimetype: "text/plain"
    4. username: "patthoyts"
  8. Add attachment "getusername.patch" [a10ab1291a] (rid 96910) by patthoyts on 2009-06-30 21:29:07.

  9. Ticket change [75db0d4269] (rid 105460) by patthoyts on 2009-06-30 21:29:34:

    1. icomment:
      You might try the attached patch. In general the Tcl code is compiled as narrow (TCHAR == char) and it switches the win32 api functions at runtime using the tclWinProcs global. So GetUserName should have been indirectly accessed using this.
      This patch seems to work for me and I tried forcing a cyrillic name through it and that was ok too.
      
      
    2. login: "patthoyts"
    3. mimetype: "text/plain"
    4. username: "patthoyts"
  10. Ticket change [53dbfa5bd8] (rid 93827) by patthoyts on 2009-07-01 21:07:10:

    1. icomment:
      I've tested this using an accented account and also by launching a tcl process as SYSTEM as a scheduled task and in all cases the username is coming up ok now.
      Committed to 8.5 and HEAD
      
      
    2. login: "patthoyts"
    3. mimetype: "text/plain"
    4. username: "patthoyts"
  11. Ticket change [5086c8cab2] (rid 125988) by patthoyts on 2009-07-01 21:07:13:

    1. assignee changed to: "patthoyts"
    2. closedate changed to: "2009-07-01T14:07:13"
    3. closer changed to: "patthoyts"
    4. foundin changed to: "obsolete: 8.5.7"
    5. icomment:
      
      
      allow_comments - 1
      
      
      
    6. login: "patthoyts"
    7. mimetype: "text/plain"
    8. resolution changed to: "Fixed"
    9. status changed to: "Closed"
    10. username: "patthoyts"