|
2026-11-27
| ||
| 15:23 | • Pending ticket [c8d4f01a54]: Windows: NTFS symbolic links are not supported by [... artifact: ec2814aa01 user: jan.nijtmans | |
| 14:46 | Fix [c8d4f0]: Windows: "file readlink" failed on symbolic links check-in: 91dee7634c user: jan.nijtmans tags: trunk, main | |
|
2026-11-22
| ||
| 22:58 | • Closed ticket [08203e40e3]: Windows: file delete -force fails on a directory c... artifact: 29fcdf14f1 user: jan.nijtmans | |
|
2026-11-13
| ||
| 11:18 | • Ticket [c8d4f01a54] Windows: NTFS symbolic links are not supported by file... artifact: 991db203ea user: serhiy.storchaka | |
|
2026-10-18
| ||
| 13:54 | • Ticket [c8d4f01a54]: 3 changes artifact: d02196d5fb user: serhiy.storchaka | |
| 13:50 | Fix [c8d4f01a54]: on Windows, [file readlink] failed on symbolic links (only junctions worked), and ... closed check-in: 5bb849a202 user: serhiy.storchaka tags: win-readlink-symlinks | |
|
2026-10-17
| ||
| 10:53 | • Ticket [c8d4f01a54] Windows: NTFS symbolic links are not supported by file... artifact: 1b2bd46b32 user: serhiy.storchaka | |
|
2025-12-28
| ||
| 17:57 | • Ticket [c8d4f01a54]: 3 changes artifact: 1decde46a7 user: apnadkarni | |
|
2024-09-22
| ||
| 05:31 | • Ticket [c8d4f01a54]: 3 changes artifact: b66bb4c5e0 user: juliannoble2 | |
|
2019-03-11
| ||
| 21:07 | • Ticket [c8d4f01a54]: 3 changes artifact: dfce61662e user: kjnash | |
|
2016-02-25
| ||
| 07:47 | • Ticket [c8d4f01a54]: 3 changes artifact: f24b075b11 user: apnadkarni | |
|
2015-09-08
| ||
| 08:56 | • Ticket [c8d4f01a54]: 7 changes artifact: 03c6ab97e3 user: dkf | |
|
2015-09-04
| ||
| 14:28 | • New ticket [c8d4f01a54]. artifact: 91379c2f80 user: anonymous | |
Windows: NTFS symbolic links are not supported by [file]
Tcl supports NTFS junctions, but not NTFS symbolic links. [file link], [file readlink] etc. all fail with messages about not a directory.
29fcdf14f1Closed ticket [08203e40e3]: Windows: [file delete -force] fails on a directory containing a symlink plus 8 other changes ticket2026-11-22 22:58:125bb849a202Fix [c8d4f01a54]: on Windows, [file readlink] failed on symbolic links (only junctions worked), and [file normalize] did not resolve directory symbolic links inside a path. Read the symbolic link reparse data, with relative and UNC targets. check-in2026-10-18 13:50:29
Strictly, it's new functionality, but it would be nice to have.
Some comments for future reference. As of 8.6.5, file link translates to NTFS junctions for directories and hard links for files. If support for symbolic links is added, will need to decide if the [file link -symbolic] for dirs which currently uses junctions will be changed to use symbolic links instead and any backward compatibility issues that may arise. Also, symbolic links are not supported on XP.
Yes, it would be nice to have. Even if the existing behaviour of [file link -symbolic $F1 $F2] for creating a link is preserved until the next major revision, it would be very useful if [file link $F1], [file isdirectory $F1], [file stat $F1] etc returned valid results for Windows symlinks created outside Tcl.
I think (just a feeling - no real evidence) these types of links - which behave more like unix symlinks are becoming more important/used. I'm not sure of the platform differences though. Can we add it to the list of known bugs so that it eventually gets some love?
On the radar, but will trigger some subtle compatibility differences with 9.0 behavior and some limitations w.r.t. usage (compared to Unix, and stemming from Windows itself)
Advantages
- ReFS does not support junctions but does support symbolic links
- relative paths permitted
- cross-volume links permitted (afaik)
- closer compatibility with POSIX links (relative paths being the most obvious)
Disadvantages
- Requires either admin privileges or running in developer mode. This is the biggest drawback.
- Different behaviour from 9.0
file linkon Windows but possible this might be hand waved away.
Still present in 8.6.18, 9.0.5 and 9.1 on Windows 11: [file readlink] fails on every real symlink, and only junctions work:
% file readlink dirlink ;# mklink /D dirlink target could not read link "dirlink": invalid argument % file readlink filelink ;# mklink filelink a.txt, or [file link -symbolic filelink a.txt] could not read link "filelink": not a directory
So a file link that Tcl itself has created with [file link -symbolic] since 8.6.11 ([548cd945d6]) cannot be read back.
Cause, in win/tclWinFile.c: WinReadLink() returns ENOTDIR for anything that is not a directory. For directories, WinReadLinkDirectory() does have a case for symlinks, but it tests IO_REPARSE_TAG_SYMBOLIC_LINK. The SDK and mingw-w64 headers do not define that name (theirs is IO_REPARSE_TAG_SYMLINK, 0xA000000C), so the fallback #define ... IO_REPARSE_TAG_RESERVED_ZERO makes it 0. The symlink tag never matches and the function ends in EINVAL. The same function is used by TclpObjNormalizePath(), so directory symlinks in the middle of a path are not resolved by [file normalize] either. A fix needs more than the constant: symlink reparse data uses SymbolicLinkReparseBuffer (it has an extra Flags field and can hold a relative target), not MountPointReparseBuffer, and the name should be read at SubstituteNameOffset.
Proposed fix in branch win-readlink-symlinks: [file readlink] now reads symbolic links to files and directories. Relative targets are returned as stored, like on Unix, and \??\UNC\server\share targets as \\server\share. [file normalize] resolves directory symlinks inside a path. Tests winFile-5.1 to 5.5 (all but 5.2 and 5.4 need the right to create symbolic links).
Only reading is changed: [file link -symbolic] still creates junctions for directories, so the compatibility question about creating links remains open.
Merged to [trunk]