Tcl Source Code

View Ticket
Login
Ticket UUID: 1852572
Title: file writable broken
Type: Bug Created on: 2007-12-17 18:12:02
Submitter: bgriffin Assigned to: dgp
Subsystem: 37. File System Severity: Minor
Priority: 8 Last modified: 2013-09-24 22:01:43
Status: Closed Closed by: dkf
Resolution: Fixed Closed on: 2013-09-24 22:01:43
Version: obsolete: 8.4.18
Description:
The [file writable] command is broken on Windows XP with samba server mounts.  Since bug 1193497 & 1344540 changes  were put in place, [file writable] appears to always return false for files on samba mounts.  Evidence suggests that it is also restricted to Linux systems as other (sun) samba servers seem to not exhibit this behavior.  Now, it is easy to suggest that the problem lies with the Linux version of samba, however, Tcl is the *only* application that has this problem.  There is *no* evidence that *any* other windows applications have write access problems with these samba servers.

I've been able to reproduce the problem using 8.4.14, and 8.5.0 rc3.  The samba server I'm using is:

$ rpm -q samba                                        
samba-3.0.10-1.4E.9

Running on:

$ cat /etc/redhat-release 
Red Hat Enterprise Linux WS release 4 (Nahant Update 4)
$ uname -a
Linux modport 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux

My samba configuration is:

[global]
        workgroup = mygroup
        server string = Samba Server
        printcap name = /etc/printcap
        load printers = yes
        cups options = raw
        log file = /var/log/samba/%m.log
        max log size = 50
        socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
        dns proxy = no
        idmap uid = 16777216-33554431
        idmap gid = 16777216-33554431
        template shell = /bin/false
        password server = None
        username map = /etc/samba/smbusers
        winbind use default domain = no
[homes]
        comment = Home Directories
        browseable = no
        writeable = yes
[printers]
        comment = All Printers
        path = /var/spool/samba
        browseable = no
        printable = yes
[scratch]
        path = /export/scratch
        writeable = yes
        guest ok = yes

I believe this to be a high priority bug.  I suggest backing out the patch from 1344540 and starting over.  I believe the logic in the patch is flawed in some fundamental way.
User Comments:
bgriffin added on 2007-12-18 02:12:05:
Logged In: YES 
user_id=22949
Originator: YES

This appears to be the same bug reported here:

[ 1613456 ] file readable lies with samba shared folder or file

Also, engineers at both Mentor Graphics and Xilinx have done extensive testing and all fingers point to Tcl.

bgriffin added on 2007-12-20 05:32:37:
Logged In: YES 
user_id=22949
Originator: YES

This appears to be the same bug reported here:

[ 1613456 ] file readable lies with samba shared folder or file

Also, engineers at both Mentor Graphics and Xilinx have done extensive testing and all fingers point to Tcl.

dannyzeng added on 2009-02-11 12:40:25:
Reproduced this issue with ActivateTcl 8.4.18.0 on a Windows XP machine.
Z: is a mapped share from a samba 3.0.10 server on Red Hat Enterprise Linux WS release 4 (Nahant Update 4)

in ActiveTcl tchsh84 
% info patchlevel
8.4.18
% cd z:
% cd zeng
% dir
 Volume in drive Z is saber
 Volume Serial Number is 0E36-0531

 Directory of Z:\zeng

2009-02-11  13:21    <DIR>          .
2009-02-11  13:18    <DIR>          ..
2009-02-11  13:18                13 test2.txt
2009-02-11  13:18                13 test.txt
               2 File(s)             26 bytes
               2 Dir(s)  38,612,762,624 bytes free
% file  writable test.txt
0
% cat test.txt >>test2.txt
% dir
 Volume in drive Z is saber
 Volume Serial Number is 0E36-0531

 Directory of Z:\zeng

2009-02-11  13:21    <DIR>          .
2009-02-11  13:18    <DIR>          ..
2009-02-11  13:34                26 test2.txt
2009-02-11  13:18                13 test.txt
               2 File(s)             39 bytes

dannyzeng added on 2009-02-11 12:45:15:
Reproduced this issue with ActivateTcl 8.5
 - tcl can write to a file but "file writable" reported false.

% info patchlevel
8.5.2
% pwd
Z:/zeng
% file writable test.txt
0
% cat test.txt >>test2.txt
% dir
 Volume in drive Z is saber
 Volume Serial Number is 0E36-0531

 Directory of Z:\zeng

2009-02-11  13:21    <DIR>          .
2009-02-11  13:18    <DIR>          ..
2009-02-11  13:35                39 test2.txt
2009-02-11  13:18                13 test.txt
               2 File(s)             52 bytes
               2 Dir(s)  38,612,762,624 bytes free

dannyzeng added on 2009-02-11 12:47:30:
tcl 8.4 in Cygwin on the same machine does not have this issue.

$ uname
CYGWIN_NT-5.1

zeng@zeng-d630 ~
$ tclsh84
% cd z:/zeng
% file writable test2.txt
1
% file writable test.txt
1

dannyzeng added on 2009-02-11 12:50:34:
in comment above for ActiveTcl on XP, I should have checked the other file, same false report in both versions.


% info patchlevel
8.4.18
% pwd
Z:/zeng
% file writable test2.txt
0

and

% info patchlevel
8.5.2
% pwd
Z:/zeng
% file writable test2.txt
0

dgp added on 2009-02-11 13:33:13:

data_type - 110894

why was this in the Patches
Tracker?

dkf added on 2009-02-15 16:15:20:
(Note: I cannot test this at all; I don't have a Linux system at the moment *or* Samba at all.)

These files, can they be actually written by Tcl? As in, can you [open] them for writing/appending? If so, the problem is in Tcl_FSAccess(); [file writable] is a thin layer over that API. Due to fundamental race conditions, it is strongly recommended that if you need to write a file, you should just [open] it and get on with it (using [catch] - or [try] in 8.6 - to handle failures) rather than doing [file writable] first to see if you might succeed.

Note also (to anyone working on a fix) that doing Tcl_FSStat() and then looking at the permissions bits is not a workaround at all; it will fail utterly on systems with ACLs such as AFS. (I suspect that there may be a problem with either Linux or Samba's handling of the access() syscall in this case, but due to the race condition it is not something I consider to be a disaster.)

bgriffin added on 2009-02-16 01:21:42:
Yes, opening and writing to the file is ok, but it's not quite that simple.  The application needs to know the access rights, long before there is any need to actually write to the file, in order to determine how to treat the file.  Think about using vi or emacs on a read-only file.  In our particular case, the file is more like a database and we need to warn the user that updates to the db will not be possible during the session.  But this is just one use model.  In another situation we display a file list along with access rights (like ls -l).  The list can be hundreds of files.  Opening each of these for write just to check write access is an unreasonable expectation.

For now, we do open the file as an access check.  In all the years operating with Tcl prior to the introduction of patch 1344540 we never experienced any race issues.  Other, non-tcl, parts of our application rely on access() only with great success.  Doing so puts the onus on MS Windows crt to deal correctly with acl's.

dkf added on 2009-02-16 03:19:08:
The race condition stuff is only really a problem when multiple applications (or multiple users) are trying to update the file at once. That's not a situation that Win is very good at handling, but also Not Our Fault. And isn't the key trouble for you.

Looking through NativeAccess() in tclWinFile.c, it seems that something must be wrong in second stage of the function, which is where we are trying to check the security access for the file. Though you could try using a debugger to see which branches in that function it takes; that would be very helpful to whoever ends up fixing this issue...

(Goodness me! That code is nasty...)

dannyzeng added on 2009-02-16 14:53:40:
gdb log sent to dkf and tcl-win mail list.

dkf added on 2009-02-16 17:05:36:
Trace indicates that it is the call to AccessCheck (i.e. tclWinProcs->accessCheckProc) that is deciding that the check fails, but there are no untoward actual failures.

According to http://msdn.microsoft.com/en-us/library/aa374815(VS.85).aspx the desiredAccess parameter must not contain any generic access rights. We only use generic rights, so this could be a source of trouble... Apparently, we need to use MapGenericMask to convert.

dannyzeng added on 2009-02-17 09:23:55:
Attaching the gdb log here.

$ gdb tclsh85g.exe 
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) dll-symbol tcl85g.dll
(gdb) list NativeAccess
1538    
1539    static int
1540    NativeAccess(
1541        const TCHAR *nativePath,    /* Path of file to access, native encoding. */
1542        int mode)                   /* Permission setting. */
1543    {
1544        DWORD attr;
1545    
1546        attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
1547    
(gdb)    break 1546
(gdb) run
#
# break reached and I played around
# 
(gdb)    cont     
... 
#
# now in tclsh I changed to the network drive and 
# issued "file writable test.txt"
# where text.txt is a file I created and modified a few times
#
#
Breakpoint 1, NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1546
1546        attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
(gdb) next
1548        if (attr == 0xffffffff) {
(gdb) print attr
$4 = 32
(gdb) info stack
#0  NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1548
#1  0x64e63b68 in TclpObjAccess (pathPtr=0xae2408, mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:2385
#2  0x64e12026 in Tcl_FSAccess (pathPtr=0xae2408, mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclIOUtil.c:2127
#3  0x64d9ea6c in CheckAccess (interp=0x3d7f48, pathPtr=0xae2408, mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclCmdAH.c:1409
#4  0x64d9e9f2 in Tcl_FileObjCmd (dummy=0x0, interp=0x3d7f48, objc=3, 
    objv=0xa9d2b8)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclCmdAH.c:1370
#5  0x64d92e5d in TclEvalObjvInternal (interp=0x3d7f48, objc=3, objv=0xa9d2b8, 
    command=0xffffffff "P~o", length=-1, flags=0)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclBasic.c:3690
#6  0x64de44a4 in TclExecuteByteCode (interp=0x3d7f48, codePtr=0xae5338)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclExecute.c:2340
#7  0x64de2a3f in TclCompEvalObj (interp=0x3d7f48, objPtr=0xae2450, 
    invoker=0x0, word=0)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclExecute.c:1474
#8  0x64d949cc in TclEvalObjEx (interp=0x3d7f48, objPtr=0xae2450, 
    flags=131072, invoker=0x0, word=0)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclBasic.c:5095
#9  0x64d94623 in Tcl_EvalObjEx (interp=0x3d7f48, objPtr=0xae2450, 
    flags=131072) at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclBasic.c:4903
#10 0x64df9150 in Tcl_RecordAndEvalObj (interp=0x3d7f48, cmdPtr=0xae2450, 
    flags=131072)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclHistory.c:161
#11 0x64e19f35 in Tcl_Main (argc=-1, argv=0x3d269c, 
    appInitProc=0x401378 <Tcl_AppInit>)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclMain.c:554
#12 0x00401371 in main (argc=1, argv=0x3d2698)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclAppInit.c:102
(gdb)
(gdb) next
1557        if ((mode & W_OK)
(gdb) 
1571        if (mode & X_OK) {
(gdb) 
1594        if ((mode != F_OK) && (tclWinProcs->getFileSecurityProc != NULL)) {
(gdb) 
1595            SECURITY_DESCRIPTOR *sdPtr = NULL;
(gdb) 
1598            HANDLE hToken = NULL;
(gdb) 
1599            DWORD desiredAccess = 0, grantedAccess = 0;
(gdb) 
1600            BOOL accessYesNo = FALSE;
(gdb) 
1602            DWORD privSetSize = sizeof(PRIVILEGE_SET);
(gdb) 
1609            size = 0;
(gdb) 
1610            (*tclWinProcs->getFileSecurityProc)(nativePath,
(gdb)  
0x77dfbcde in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
0x7c9140fd in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1618
1618            error = GetLastError();
(gdb)  
1619            if (error != ERROR_INSUFFICIENT_BUFFER) {
(gdb) print error
$5 = 122
(gdb)
(gdb) next
1633            sdPtr = (SECURITY_DESCRIPTOR *) HeapAlloc(GetProcessHeap(), 0, size);
(gdb) 
1635            if (sdPtr == NULL) {
(gdb) 
1643            if (!(*tclWinProcs->getFileSecurityProc)(nativePath,
(gdb) 
0x77dfbcde in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
0x7c9140fd in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1658
1658            if (!(*tclWinProcs->impersonateSelfProc)(SecurityImpersonation)) {
(gdb) 
0x77dfd203 in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
0x7c92aa7d in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1665
1665            if (!(*tclWinProcs->openThreadTokenProc)(GetCurrentThread(),
(gdb) 
0x77dd7b3d in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
0x7c90de0e in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1674
1674            (*tclWinProcs->revertToSelfProc)();
(gdb) 
0x77dd7ba9 in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
0x7c90e642 in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1681
1681            if (mode & R_OK) {
(gdb)
(gdb) next
1684            if (mode & W_OK) {
(gdb) 
1685                desiredAccess |= FILE_GENERIC_WRITE;
(gdb) 
1687            if (mode & X_OK) {
(gdb) 
1691            memset(&genMap, 0x0, sizeof(GENERIC_MAPPING));
(gdb) 
1692            genMap.GenericRead = FILE_GENERIC_READ;
(gdb) 
1693            genMap.GenericWrite = FILE_GENERIC_WRITE;
(gdb) 
1694            genMap.GenericExecute = FILE_GENERIC_EXECUTE;
(gdb) 
1695            genMap.GenericAll = FILE_ALL_ACCESS;
(gdb) 
1701            if (!(*tclWinProcs->accessCheckProc)(sdPtr, hToken, desiredAccess,
(gdb) 
0x77dd7c11 in _libws2_32_a_iname ()
(gdb) 
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
0x7c90d38e in _libws2_32_a_iname ()
(gdb)
Single stepping until exit from function _libws2_32_a_iname, 
which has no line number information.
NativeAccess (nativePath=0xae53e0 "t", mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:1723
1723            HeapFree(GetProcessHeap(), 0, sdPtr);
(gdb) 
1724            CloseHandle(hToken);
(gdb) 
1725            if (!accessYesNo) {
(gdb) 
1726                Tcl_SetErrno(EACCES);
(gdb) 
1727                return -1;
(gdb)
1743    }
(gdb) list
1738                Tcl_SetErrno(EACCES);
1739                return -1;
1740            }
1741        }
1742        return 0;
1743    }
1744    ^L
1745    /*
1746     *----------------------------------------------------------------------
1747     *
(gdb) next
TclpObjAccess (pathPtr=0xae2408, mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/win/tclWinFile.c:2386
2386    }
(gdb) 
Tcl_FSAccess (pathPtr=0xae2408, mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclIOUtil.c:2133
2133    }
(gdb) 
CheckAccess (interp=0x3d7f48, pathPtr=0xae2408, mode=2)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclCmdAH.c:1411
1411        Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
(gdb) 
1413        return TCL_OK;
(gdb) 
1414    }
(gdb) 
Tcl_FileObjCmd (dummy=0x0, interp=0x3d7f48, objc=3, objv=0xa9d2b8)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclCmdAH.c:1376
1376    }
(gdb) 
TclEvalObjvInternal (interp=0x3d7f48, objc=3, objv=0xa9d2b8, 
    command=0xffffffff "P~o", length=-1, flags=0)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclBasic.c:3696
3696        if (TclAsyncReady(iPtr)) {
(gdb) 
3699        if (code == TCL_OK && TclLimitReady(iPtr->limit)) {
(gdb) 
3707        if (traced) {
(gdb) 
3738        TclCleanupCommandMacro(cmdPtr);
(gdb) 
3747        if (*(iPtr->result) != 0) {
(gdb) 
3759        if (savedVarFramePtr) {
(gdb) 
3762        return code;
(gdb) print code
$6 = 0
(gdb) next
3849    }
(gdb) 
TclExecuteByteCode (interp=0x3d7f48, codePtr=0xae5338)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclExecute.c:2342
2342                CACHE_STACK_INFO();
(gdb) 
2343                iPtr->cmdFramePtr = iPtr->cmdFramePtr->nextPtr;
(gdb) 
2345                if (result == TCL_OK) {
(gdb) 
2349                    if (*(pc+pcAdjustment) == INST_POP) {
(gdb) 
2361                    objResultPtr = Tcl_GetObjResult(interp);
(gdb) 
2376                    TclNewObj(objPtr);
(gdb) 
2377                    Tcl_IncrRefCount(objPtr);
(gdb) 
2378                    iPtr->objResultPtr = objPtr;
(gdb) 
2379                    NEXT_INST_V(pcAdjustment, objc, -1);
(gdb) 
1794            switch (cleanup) {
(gdb) 
1799                cleanup -= 2;
(gdb)
1800                while (cleanup--) {
(gdb) 
1801                    valuePtr = POP_OBJECT();
(gdb) 
1802                    TclDecrRefCount(valuePtr);
(gdb) 
1800                while (cleanup--) {
(gdb) 
1806                valuePtr = POP_OBJECT();
(gdb) 
1807                TclDecrRefCount(valuePtr);
(gdb) 
1810                valuePtr = OBJ_AT_TOS;
(gdb) 
1811                TclDecrRefCount(valuePtr);
(gdb) 
1813            OBJ_AT_TOS = objResultPtr;
(gdb) 
1814            goto cleanup0;
(gdb) 
1866        if ((instructionCount++ & ASYNC_CHECK_COUNT_MASK) == 0) {
(gdb) 
1907        if (*pc == INST_LOAD_SCALAR1) {
(gdb) 
1909        } else if (*pc == INST_PUSH1) {
(gdb) 
1913        switch (*pc) {
(gdb) 
1956            if (tosPtr > initTosPtr) {
(gdb) 
1964                Tcl_SetObjResult(interp, OBJ_AT_TOS);
(gdb) 
1972                goto checkForCatch;
(gdb) 
7278            if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) {
(gdb) 
7286            iPtr->flags &= ~ERR_ALREADY_LOGGED;
(gdb) 
7293            while ((expandNestList != NULL) && ((catchTop == initCatchTop) ||
(gdb) 
7308            if (TclLimitExceeded(iPtr->limit)) {
(gdb) 
7317            if (catchTop == initCatchTop) {
(gdb) 
7324                goto abnormalReturn;
(gdb) 
7379            while (tosPtr > initTosPtr) {
(gdb) 
7380                Tcl_Obj *objPtr = POP_OBJECT();
(gdb) 
7382                Tcl_DecrRefCount(objPtr);
(gdb) 
7379            while (tosPtr > initTosPtr) {
(gdb) 
7389            while (expandNestList) {
(gdb) 
7395            if (tosPtr < initTosPtr) {
(gdb) 
7405        TclArgumentBCRelease((Tcl_Interp*) iPtr,codePtr);
(gdb) 
7411        TclStackFree(interp, initCatchTop+1);
(gdb) 
7412        return result;
(gdb) 
7414    }
(gdb) print result
$7 = 0
(gdb) next
TclCompEvalObj (interp=0x3d7f48, objPtr=0xae2450, invoker=0x0, word=0)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclExecute.c:1475
1475            codePtr->refCount--;
(gdb) 
1476            if (codePtr->refCount <= 0) {
(gdb) 
1500        iPtr->numLevels--;
(gdb) 
1501        return result;
(gdb) 
1502    }
(gdb) 
TclEvalObjEx (interp=0x3d7f48, objPtr=0xae2450, flags=131072, invoker=0x0, 
    word=0) at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclBasic.c:5102
5102            if (iPtr->numLevels == 0) {
(gdb) 
5103                if (result == TCL_RETURN) {
(gdb) 
5106                if ((result != TCL_OK) && (result != TCL_ERROR)
(gdb) 
5114            iPtr->evalFlags = 0;
(gdb) 
5115            iPtr->varFramePtr = savedVarFramePtr;
(gdb) 
5119        TclDecrRefCount(objPtr);
(gdb) 
5120        return result;
(gdb) 
5121    }
(gdb)
Tcl_EvalObjEx (interp=0x3d7f48, objPtr=0xae2450, flags=131072)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclBasic.c:4904
4904    }
(gdb) 
Tcl_RecordAndEvalObj (interp=0x3d7f48, cmdPtr=0xae2450, flags=131072)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclHistory.c:163
163         return result;
(gdb) 
164     }
(gdb) 
Tcl_Main (argc=-1, argv=0x3d269c, appInitProc=0x401378 <Tcl_AppInit>)
    at d:/msys/1.0/home/zeng/src/tcl8.5.6/generic/tclMain.c:555
555                 inChannel = Tcl_GetStdChannel(TCL_STDIN);
(gdb) 
556                 outChannel = Tcl_GetStdChannel(TCL_STDOUT);
(gdb) 
557                 errChannel = Tcl_GetStdChannel(TCL_STDERR);
(gdb) 
558                 Tcl_DecrRefCount(commandPtr);
(gdb) 
559                 commandPtr = Tcl_NewObj();
(gdb) 
560                 Tcl_IncrRefCount(commandPtr);
(gdb) 
561                 if (code != TCL_OK) {
(gdb) 
566                 } else if (tty) {
(gdb) 
567                     resultPtr = Tcl_GetObjResult(interp);
(gdb) 
568                     Tcl_IncrRefCount(resultPtr);
(gdb) 
569                     Tcl_GetStringFromObj(resultPtr, &length);
(gdb) 
570                     if ((length > 0) && outChannel) {
(gdb) 
571                         Tcl_WriteObj(outChannel, resultPtr);
(gdb) 
572                         Tcl_WriteChars(outChannel, "\n", 1);

#
# result printed to tchsh
# 0
#
(gdb) 
574                     Tcl_DecrRefCount(resultPtr);
(gdb) 
489         while ((inChannel != (Tcl_Channel) NULL) && !Tcl_InterpDeleted(interp)) {
(gdb)
490             if (mainLoopProc == NULL) {
(gdb) 
491                 if (tty) {
(gdb) 
492                     Prompt(interp, &prompt);
(gdb) 
493                     if (Tcl_InterpDeleted(interp)) {
(gdb) 
496                     if (Tcl_LimitExceeded(interp)) {
(gdb) 
499                     inChannel = Tcl_GetStdChannel(TCL_STDIN);
(gdb) 
500                     if (inChannel == (Tcl_Channel) NULL) {
(gdb) 
504                 if (Tcl_IsShared(commandPtr)) {
(gdb) 
509                 length = Tcl_GetsObj(inChannel, commandPtr); 
(gdb) 

#
# now tclsh is ready to accept new input
#

dannyzeng added on 2009-03-03 10:00:48:
In NativeAccess, a GetServerInfo at level 101 may find a Samba server as “Windows NT 4.9 Server". Maybe we can skip some tests to avoid the false alarm.

ctasada added on 2009-07-01 23:03:20:
Hi guys,

What's the status of this bug? I've the same problem when accessing from a Vista machine to a network drive :( The same code seems to work fine both in Linux and Windows XP, accessing to the same network drive.

I'm using ActiveTcl 8.5.4

dgp added on 2009-07-01 23:09:26:
See

http://groups.google.com/group/comp.lang.tcl/msg/970b77a99ad96a10

dgp added on 2012-01-14 01:25:53:
The branch 'fix-win-native-access' includes a patch that
may fix the bug reported here.

  http://core.tcl.tk/tcl/info/0aabf0529e

I'm not equipped to test the effectiveness of the
patch, or whether it introduces any new test
failures or other problems.  I'd be grateful if folks
who can and who are intersted in this bug and related
bugs could do so, and report back whether the patch
is suitable for merging into the release branches.

dgp added on 2012-02-03 00:41:06:
Patch from fix-win-native-access branch
committed for 8.4.20, 8.5.12, and 8.6b3.

Continued testing strongly encouraged.

In particular, the #define UNICODE variant
of the trunk is likely to have some lingering
problems.