Tcl Source Code

View Ticket
Login
Ticket UUID: 3547593
Title: fcmd test failures on Windows
Type: Bug Created on: 2012-07-23 12:26:48
Submitter: twylite Assigned to: patthoyts
Subsystem: 37. File System Severity:
Priority: 5 Medium Last modified: 2026-10-21 08:47:09
Status: Closed Closed by: nijtmans
Resolution: Fixed Closed on: 2012-07-23 14:23:47
Version: obsolete: 8.5.12
Description:
Hi,

I've just done a pull/update to core-8-5-12-rc and built a 32-bit Tcl using MSVC10 on Windows 7 64-bit.  Running the test suite brings up the following failing tests:

===== fCmd.test
Test file error: can't read "tmpspace": no such variable
    while executing
"file join $tmpspace tf1"
    invoked from within
"test fCmd-6.19 {CopyRenameOneFile: errno == EXDEV} {xdev notRoot} {
    cleanup $tmpspace
    createfile tf1
    file rename tf1 $tmpspace
    glob -n..."
    (file "C:/User/Tcl_BUILD/cmake-2012/tcl/tests/fCmd.test" line 557)

==== filesystem-1.3 link normalisation FAILED
==== filesystem-1.4 link normalisation FAILED

Twylite: (both covered by #3545366 and #3075027)

==== winFCmd-2.8.1 TclpCopyFile: errno: EACCES FAILED
==== Contents of test case:

    cleanup
    list [catch {testfile cp nul tf1} msg] $msg

---- Result was:
1 EINVAL
---- Result should have been (exact matching):
1 EACCES
==== winFCmd-2.8.1 FAILED

Twylite: 2.8.1 is meant for winOlderThan2000.  I'm running on Windows 7.  Platform detection logic appears to be incorrect.


==== winFCmd-6.1 TclpRemoveDirectory: errno: EACCES FAILED
==== Contents of test case:

    cleanup
    file mkdir td1
    testchmod 000 td1
    catch {
        testfile rmdir td1
        file exists td1
    } r
    catch {
        testchmod 777 td1
        cleanup
    }
    set r

---- Result was:
td1 EACCES
---- Result should have been (exact matching):
0
==== winFCmd-6.1 FAILED

Twylite: the testchmod 000 appears to make rmdir fail (EACCES).  The subsequent testchmod 777 allows td1 to be removed.  Not sure why the test is expecting 0.

==== winFCmd-6.9 TclpRemoveDirectory: errno == EACCES FAILED
==== Contents of test case:

    cleanup
    file mkdir td1
    testchmod 000 td1
    catch {
        testfile rmdir td1
        file exists td1
    } r
    catch {
        testchmod 777 td1
        cleanup
    }
    set r

---- Result was:
td1 EACCES
---- Result should have been (exact matching):
0
==== winFCmd-6.9 FAILED

Twylite: as for winFCmd-6.1.

==== winFCmd-6.13 TclpRemoveDirectory: write-protected FAILED
==== Contents of test case:

    cleanup
    file mkdir td1
    testchmod 000 td1
    catch {
        testfile rmdir td1
        file exists td1
    } r
    catch {
        testchmod 777 td1
        cleanup
    }
    set r

---- Result was:
td1 EACCES
---- Result should have been (exact matching):
0
==== winFCmd-6.13 FAILED

Twylite: as for winFCmd-6.1.


==== winFCmd-7.15 TraverseWinTree: append \ to target if necessary FAILED
==== Contents of test case:

    cleanup
    file mkdir td1
    list [catch {testfile cpdir td1 /} msg] $msg

---- Result was:
1 {/ EEXIST}
---- Result should have been (exact matching):
1 {/ EACCES}
==== winFCmd-7.15 FAILED

Twylite: looks like Windows 7 produces a different error code.


==== winFCmd-9.3 TraversalDelete: DOTREE_PRED FAILED
==== Contents of test case:

    cleanup
    file mkdir td1/td2
    testchmod 000 td1
    catch {
        testfile rmdir -force td1
        file exists td1
    } r
    catch {
        testchmod 777 td1
        cleanup
    }
    set r

---- Result was:
td1 EACCES
---- Result should have been (exact matching):
0
==== winFCmd-9.3 FAILED

Twylite: as for winFCmd-6.1.
User Comments:
nijtmans added on 2012-07-23 21:23:46:
> Twylite: 2.8.1 is meant for winOlderThan2000. I'm running on Windows 7.
> Platform detection logic appears to be incorrect.
Indeed the platform detection logic was way too strict.
Fixed now in core-8-5-branch.

On my Windows 7, all fCmd.test testcases now pass:

Tests began at Mon Jul 23 16:22:35 CEST 2012
winFCmd.test
Tests ended at Mon Jul 23 16:22:35 CEST 2012
all.tcl:        Total   182     Passed  158     Skipped 24      Failed  0
Sourced 1 Test Files.
Number of tests skipped for each constraint:
        9       95
        9       cdrom
        3       emptyTest
        2       exdev
        1       nonPortable

twylite added on 2012-07-24 16:03:24:
Confirmed that the fix addresses the 'tmpspace' bug and winFCmd-2.8.1.

I'm still getting the same failures on winFCmd-6.1, winFCmd-6.9, winFCmd-6.13, and winFCmd-9.3.  

Further investigation shows that the tests pass if the user has Full Control (F) permission over [pwd], and fail otherwise (giving EACCES, but cleaning up correctly).  Note that users may often have only Change (C) permission rather than Full Control for a particular folder.  

This may be a curiosity of NTFS, or it could be that [file rmdir] needs to attempt to change the permissions first (I don't know what the intended behaviour is).

nijtmans added on 2012-07-24 16:34:57:
> I'm still getting the same failures on winFCmd-6.1, winFCmd-6.9,
> winFCmd-6.13, and winFCmd-9.3. 
Those are exactly the 4 tests that are marked with
contraint winVista on trunk, in the following commit.

Patrick, can you shine a light on this? Should
your fix be backported?
===============================================================
2009-11-10  Pat Thoyts  <[email protected]>
          * tests/winFCmd.test: Cleanup directories that have been set chmod 000. On Windows7 and Vista we really have no access and these were getting left behind.
 A few tests were changed to reflect the intent of the test where
setting a directory chmod 000 modification. This restriction was ignored on XP but is honoured
 on Vista

serhiy.storchaka added on 2026-10-21 08:47:09:

All the listed tests were reworked: winFCmd-2.8.1 and 6.9 were removed, 6.1, 6.13 and 9.3 were rewritten with Ashok's testchmod fixes ([24072d92fc], 2023), and 7.15 accepts EEXIST. Fixed in 8.6.14 and 9.0. Closing.