Overview
Artifact ID: | 95f90172bc117cc03089161d4b41fdcf9e400cee6367bbfc633dff66eb05949a |
---|---|
Ticket: | 9e6b569963ea497e9e623a79d5a5f92c5681bfdb
file normalize ~user fails on Windows |
User & Date: | fvogel 2018-05-15 14:04:51 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
<code>file normalize ~$::tcl_platform(user)</code> 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 [https://core.tcl.tk/tk/tktview?name=7c571871e|the Tk test suite test winDialog-5.12.2]. Looking at the code and debugging: ~fvogel looks at the <code>NetUserGetInfo</code> in <code>TclpGetUserHome</code> in tclWinFile.c In the described situation this call returns 2221 (NERR_UserNotFound). The following patch fixes the issue for me: <verbatim> 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 { </verbatim>
- foundin changed to: "All"
- is_private changed to: "0"
- login: "fvogel"
- priority changed to: "5 Medium"
- private_contact changed to: "a013af67114eccc19ad12b04f14923acea9e96b7"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "fvogel"
- subsystem changed to: "37. File System"
- title changed to: "file normalize ~user fails on Windows"
- type changed to: "Bug"