Tcl Source Code

View Ticket
Login
Ticket UUID: 3006571
Title: error deleting: file already exists on Vista
Type: Bug Created on: 2010-05-24 18:27:04
Submitter: pherricoxide Assigned to: jan.nijtmans
Subsystem: 37. File System Severity: Minor
Priority: 5 Medium Last modified: 2026-10-29 13:36:55
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-29 13:36:55
Version: 8.6.18, 9.0.5, 9.1.0
Description:
On 2 Windows Vista machines I've tried running file delete -force will sometimes return the error, "error deleting filename: file already exists". This doesn't really make any sense, since of course the file exists or I wouldn't be deleting it. Attached is a script to show the problem and result files from two Vista machines. This is using TCL ActiveState ActiveTcl 8.5.8.0.291595 threaded.
User Comments:
pherricoxide added on 2010-05-25 01:27:05:

File Added - 375021: filedel.tcl

pherricoxide added on 2010-05-25 01:28:15:
Result of script,

Deleted C:/vvv
Deleted C:/vvv
error deleting "C:/vvv": file already exists
error deleting "C:/vvv\foo": permission denied
error deleting "C:/vvv\foo": permission denied
Deleted C:/vvv
Deleted C:/vvv
error deleting "C:/vvv": file already exists
Deleted C:/vvv
error deleting "C:/vvv": file already exists
Deleted C:/vvv
Deleted C:/vvv
Deleted C:/vvv

dunkfan added on 2010-09-03 16:56:44:
Also seen sporadically on Win7 64bit dual core machine. Tcl 8.5.5 threaded.

gahr added on 2013-01-17 18:54:11:
I'm also seeing this on 8.6.0 threaded, on a cifs-mounted filesystem. Workaround here is to retry after several msec.

serhiy.storchaka added on 2026-10-23 10:06:30:

Reproduced on 8.6, 9.0 and main under Wine, and on Windows 11 on an SMB share, when another process keeps a file in the tree open with FILE_SHARE_DELETE (as virus scanners and indexers do): the file is only marked for deletion, so removing its directory fails with ERROR_DIR_NOT_EMPTY, reported as "file already exists". Local NTFS on Windows 10 1903+ is not affected.

Proposed fix in branch win-delete-retry-not-empty: retry removing the directory for up to about 1 s, as suggested in the comment above. Also the path in the error message now uses "/" only.


jan.nijtmans added on 2026-10-29 13:36:55:

Fixed in [82967ff42a|trunk], core-9-0-branch and core.8.6.branch

Many thanks!

One closing '}' was placed wrong in your patch. Not a serious deal, but some compilers might still produce a warning on that .... spotted in time.


Attachments: