Tcl Source Code

View Ticket
Login
Ticket UUID: 533361
Title: file delete does not on W2000/NT
Type: Bug Created on: 2002-03-21 23:22:51
Submitter: nobody Assigned to: hobbs
Subsystem: 37. File System Severity:
Priority: 3 Low Last modified: 2008-01-28 10:20:11
Status: Closed Closed by: sf-robot
Resolution: Out of Date Closed on: 2008-01-28 03:20:11
Version: obsolete: 8.3.2
Description:
The following code will not work correctly in Tcl
8.3.2, if executed on W2000/NT on a Samba network
share, even if the user posseses the necessary permissions:

> cd //SambaServer/jdoe
> glob test_dir
test_dir
> glob test_dir/file
test_dir/file
> file delete -force test_dir
error delting "test_dir": permission denied

I could trace down this problem to the
DoRemoveDirectory function in win/tclWinFCmd.c.
Apparently the first attempt to delete the directory
yields an EACCESS error whereas a ENOTEMPTY is expected.

Since the code already handles this behaviour for Win9x
in this function, this simple work arround fixes the issue:

Index: tclWinFCmd.c
===================================================================
RCS file: /export/home/cvs/scriptics/tcl/win/tclWinFCmd.c,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 tclWinFCmd.c
840,841c840
<
<           if (TclWinGetPlatformId() !=
VER_PLATFORM_WIN32_NT) {
---
>           if (1 /*TclWinGetPlatformId() !=
VER_PLATFORM_WIN32_NT*/) {
User Comments:
vincentdarley added on 2002-03-24 19:33:52:
Logged In: YES 
user_id=32170

We need a patch for Tcl 8.4a5 (in which the above line 
numbers are very different --- how about a context diff?), 
and the test suite needs running on a variety of Windows 
OSes to make sure the 'fix' doesn't break anything else.

vincentdarley added on 2002-04-05 00:50:32:
Logged In: YES 
user_id=32170

The relevant line is 923 in the latest cvs head, with the 
following context:

    /* 
     * Windows 95 and Win32s report removing a non-
empty directory 
     * as EACCES, not EEXIST.  If the directory is 
not empty,
     * change errno so caller knows what's going on.
     */

    if (TclWinGetPlatformId() != 
VER_PLATFORM_WIN32_NT) {
CONST char *path, *find;
HANDLE handle;
WIN32_FIND_DATAA data;
Tcl_DString buffer;

Looking at the code, the change looks harmless enough, but 
whoever reported this bug ought to test the fix with Tcl 
8.4a5 and run the test suite over it.

vincentdarley added on 2003-09-16 22:56:37:
Logged In: YES 
user_id=32170

I don't use any systems with samba shared volumes, so can't
test this at all. It does looks like a sensible one-line fix
however, so, Jeff, can you test this and fix if you believe
it's ok?

hobbs added on 2008-01-14 06:33:01:
Logged In: YES 
user_id=72656
Originator: NO

network permissions changes have been added over time, but we also have new reports with more accurate recent behavior to deal with.

sf-robot added on 2008-01-28 10:20:11:
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).