Tcl Source Code

Ticket Change Details
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.
Overview

Artifact ID: 95f90172bc117cc03089161d4b41fdcf9e400cee6367bbfc633dff66eb05949a
Ticket: 9e6b569963ea497e9e623a79d5a5f92c5681bfdb
file normalize ~user fails on Windows
User & Date: fvogel 2018-05-15 14:04:51
Changes

  1. Change assignee to "nobody"
  2. Change closer to "nobody"
  3. Change cmimetype to "text/x-fossil-wiki"
  4. Change comment to:

    file normalize ~$::tcl_platform(user)

    returns:

    - in tclsh86tg, normal user : user "fvogel" doesn't exist
    - in tclsh86tg run as Admin : C:/Users/l-vogel

    The computer is a Win 7 machine connected to a domain controller with an active directory.

    This problem was first detected with the Tk test suite test winDialog-5.12.2.

    Looking at the code and debugging:

    ~fvogel looks at the NetUserGetInfo in TclpGetUserHome in tclWinFile.c In the described situation this call returns 2221 (NERR_UserNotFound).

    The following patch fixes the issue for me:

    Index: win/tclWinFile.c
    ==================================================================
    --- win/tclWinFile.c
    +++ win/tclWinFile.c
    @@ -1442,10 +1442,11 @@
         int nameLen = -1;
         int badDomain = 0;
         char *domain;
         WCHAR *wName, *wHomeDir, *wDomain, **wDomainPtr = &wDomain;
         WCHAR buf[MAX_PATH];
    +    LPCWSTR wServername = NULL;
    
         Tcl_DStringInit(bufferPtr);
         wDomain = NULL;
         domain = strchr(name, '@');
         if (domain != NULL) {
    @@ -1456,11 +1457,12 @@
            nameLen = domain - name;
         }
         if (badDomain == 0) {
            Tcl_DStringInit(&ds);
            wName = Tcl_UtfToUniCharDString(name, nameLen, &ds);
    -       if (NetUserGetInfo(wDomain, wName, 1, (LPBYTE *) uiPtrPtr) == 0) {
    +        NetGetDCName(NULL, wDomain, (LPBYTE *) &wServername);
    +       if (NetUserGetInfo(wServername, wName, 1, (LPBYTE *) uiPtrPtr) == 0) {
                wHomeDir = uiPtr->usri1_home_dir;
                if ((wHomeDir != NULL) && (wHomeDir[0] != L'\0')) {
                    Tcl_UniCharToUtfDString(wHomeDir, lstrlenW(wHomeDir),
                            bufferPtr);
                } else {
    
  5. Change foundin to "All"
  6. Change is_private to "0"
  7. Change login to "fvogel"
  8. Change priority to "5 Medium"
  9. Change private_contact to "a013af67114eccc19ad12b04f14923acea9e96b7"
  10. Change resolution to "None"
  11. Change severity to "Minor"
  12. Change status to "Open"
  13. Change submitter to "fvogel"
  14. Change subsystem to "37. File System"
  15. Change title to "file normalize ~user fails on Windows"
  16. Change type to "Bug"