| Ticket UUID: | 226413 | ||
| Title: | file delete cannot delete nonempty directories on Windows 98 | ||
| Type: | Bug | Created on: | 2000-12-20 02:04:59 |
| Submitter: | jhilbert | Assigned to: | aku |
| Subsystem: | 37. File System | Severity: | Minor |
| Priority: | 4 | Last modified: | 2013-09-27 08:54:22 |
| Status: | Closed | Closed by: | dkf |
| Resolution: | Out of Date | Closed on: | 2013-09-27 08:54:22 |
| Version: | obsolete: 8.3.1 | ||
| Description: | ||||
"file delete -force" deletes nonempty directories on Windows NT, but not on Windows 98. The following script demonstrates. im4u is a Windows 98 machine, annas_nt is an NT 4.0 machine % file mkdir //im4u/c-drive/testdir % open //im4u/c-drive/testdir/jon w fileabd120 % close fileabd120 % glob //im4u/c-drive/testdir/* //im4u/c-drive/testdir/jon % file delete //im4u/c-drive/testdir error deleting "//im4u/c-drive/testdir": permission denied % file delete -force -- //im4u/c-drive/testdir error deleting "//im4u/c-drive/testdir": permission denied % file delete //im4u/c-drive/testdir/jon % file delete //im4u/c-drive/testdir % glob //im4u/c-drive/testdir/* no files matched glob pattern "//im4u/c-drive/testdir/*" % glob //im4u/c-drive/test* no files matched glob pattern "//im4u/c-drive/test*" % file mkdir //annas_nt/c-drive/testdir % open //annas_nt/c-drive/testdir/jon w fileabe3a0 % close fileabe3a0 % file delete //annas_nt/c-drive/testdir error deleting "//annas_nt/c-drive/testdir": directory not empty % file delete -force -- //annas_nt/c-drive/testdir % glob //annas_nt/c-drive/test* no files matched glob pattern "//annas_nt/c-drive/test*" | ||||
| User Comments: | ||||
dkf added on 2001-01-27 22:46:17:
It obviously depends on something fairly subtle, since the following worked as advertised for me with 8.3.0:
% cd /windows/temp
% file mkdir foo
% cd foo
% close [open bar w]
% cd ..
% list [catch {file delete foo} msg] $msg
1 {error deleting "foo": directory not empty}
% list [catch {file delete -force foo} msg] $msg
0 {}
jhilbert added on 2001-02-17 02:51:53:
I believe another symptom I have discovered is relevant. The TclpStat() routine returns different results depending on whether it is running on W98 or W2000/NT, depending on what type of pathname is passed to it. Apparently W98 does not perform as expected by TclpStat() if the pathname is the root drive of a volume shared on another machine (e.g. \\server\volume). This causes several parts of the Tcl file command to misbehave, including "file delete" as mentioned in the original bug, and "file isdirectory" and "file mkdir".
The following simple C program can be used to show the difference. Compile and run it as a console app, passing a filename as a single argument. It returns the results of a FindFirstFile() call and a GetFileAttributes() call on the filename.
#include <windows.h>
#include <stdio.h>
#include <sys/stat.h>
int main(int argc, char* argv[])
{
if (argc>1) {
DWORD attr = GetFileAttributes(argv[1]);
printf("flag for directory is %08X",FILE_ATTRIBUTE_DIRECTORY);
printf("\nattributes from GetFileAttributes(%s) : %08X",argv[1],attr);
WIN32_FIND_DATA findData;
HANDLE handle = FindFirstFile(argv[1],&findData);
if (handle != INVALID_HANDLE_VALUE) {
printf("\nattributes from FindFirstFile(%s): %08X",argv[1], findData.dwFileAttributes);
} else {
printf("\nFindFirstFile(%s) returned: %08X",argv[1],(DWORD)handle);
}
return 0;
}
printf("usage: %s <filename>",argv[0]);
return 1;
}
jhilbert added on 2001-02-17 02:53:58:
BTW, the symptom I describe in my Feb-16 comment appears to be directly relevant to the symptom described in bug #119351 as well. andreas_kupries added on 2001-08-24 04:49:32:
Logged In: YES user_id=75003 SF renumbering dance. He refers to #219351. vincentdarley added on 2001-08-24 23:50:59:
Logged In: YES user_id=32170 I don't have Win98 to test on, nor am I familiar with Win32 guts to be able to resolve this. hobbs added on 2001-08-25 01:10:15:
Logged In: YES user_id=72656 This worked just fine for me testing from a Win98 and WinME box to the Win98 share, but on Win2K it does return the problem. I'm not sure what the best way to work around that would be. dkf added on 2013-09-27 08:54:22:
Win98 long obsolete; all current versions of Windows are based on NT, and currently supported Tcl versions do not support Win98 at all. | ||||
