|
2026-11-22
| ||
| 22:58 | • Closed ticket [08203e40e3]: Windows: file delete -force fails on a directory c... artifact: 29fcdf14f1 user: jan.nijtmans | |
|
2026-10-31
| ||
| 19:46 | Fix [08203e]: Windows: [file delete -force] failed on a directory containing a symbolic link check-in: 95b8eb73c5 user: jan.nijtmans tags: core-8-6-branch | |
| 19:16 | Fix [08203e]: Windows: [file delete -force] failed on a directory containing a symbolic link check-in: a59fcaf470 user: jan.nijtmans tags: core-9-0-branch | |
|
2026-10-30
| ||
| 22:23 | Fix [08203e]: Windows: [file delete -force] failed on a directory containing a symbolic link check-in: 6f1fbfbc88 user: jan.nijtmans tags: trunk, main | |
|
2026-10-20
| ||
| 18:11 | • Ticket [08203e40e3] Windows: file delete -force fails on a directory containin... artifact: 1340e057a3 user: serhiy.storchaka | |
|
2026-10-17
| ||
| 14:27 | • Ticket [08203e40e3]: 3 changes artifact: 9861d42209 user: serhiy.storchaka | |
| 14:26 | Fix [08203e40e3]: on Windows, [file delete -force] failed with "invalid argument" on a directory con... closed check-in: d876873757 user: serhiy.storchaka tags: win-delete-tree-with-symlinks | |
| 10:51 | • New ticket [08203e40e3] Windows: file delete -force fails on a directory conta... artifact: f5651f90c1 user: serhiy.storchaka | |
Windows: [file delete -force] fails on a directory containing a symlink
file mkdir d close [open d/a.txt w] file link -symbolic d/b.txt d/a.txt ;# or: mklink d\b.txt a.txt file delete -force d
Actual: error deleting "...": invalid argument, and d stays. Expected: d is deleted. Deleting the link itself with [file delete d/b.txt] works.
Cause: TraverseWinTree() (win/tclWinFCmd.c) hands every reparse point to TraversalDelete() as DOTREE_LINK, which calls DoRemoveJustDirectory() and so TclWinSymLinkDelete() (win/tclWinFile.c). That function always passes IO_REPARSE_TAG_MOUNT_POINT to FSCTL_DELETE_REPARSE_POINT, which fails with a tag mismatch for a symlink (tag 0xA000000C), giving EINVAL. Even if the reparse data were removed, RemoveDirectoryW() cannot remove a file. A directory symlink inside the tree goes through the same code and probably fails the same way. The same function also explains [3c13c4ed31] ([file delete] on a directory symlink fails with "illegal operation on a directory"/"is a directory"), which was closed as Invalid. Possible fix: delete links with DeleteFileW() or RemoveDirectoryW() depending on FILE_ATTRIBUTE_DIRECTORY. Both remove the link and not its target.
Related: [972c35d41d] ([file copy] of symlinks), [c8d4f01a54] (NTFS symlinks not supported by [file]).
Seen on Windows 11 in 8.6.18, 9.0.5 and 9.1.
d876873757Fix [08203e40e3]: on Windows, [file delete -force] failed with "invalid argument" on a directory containing a symbolic link to a file or a directory (only junctions worked). Remove links to files like files, and other links to directories with RemoveDirectoryW. check-in2026-10-17 14:26:58
Proposed fix in branch win-delete-tree-with-symlinks: a link to a file is removed like a file, and a link to a directory that is not a junction (mklink /D) with RemoveDirectoryW(); the targets are not touched. Directory symbolic links inside the tree failed the same way. Tests winFCmd-9.7 and 9.8 (need the right to create symbolic links).
Merged to [trunk], core-9-0-branch and core-8-6-branch
Many thanks!