Description
Qt has traditionally considered shortcut files (.lnk) on Windows to be the equivalent of symlinks on Unix file systems. Since NTFS has now for many versions supported proper symlinks, the interpretation of shotcut files as symlinks is confusing and error prone. The implementation as of today is also inconsistent.
In addition, NTFS has the notion of junctions, which behave like hardlinks for directories, but need to be treated like symlinks in many ways (ie on the command line, they are removed via `rmdir` rather than with `del`). Qt currently has no way of reporting that a file system entry is a junction, which can lead to fatal data loss.
Qt should
- treat shortcut (.lnk) files as regular files (ie can delete them, report their file size), but be able to follow them
- introduce a more comprehensive concept of "file type", reported by QFileInfo, replacing the overly simple "isSymLink" (which can then be made obsolete in Qt 5.15), so that applications can make well-informed decisions about how to treat a file system entry
- provide appropriate implementations of basic file system operations (at the very least, use the correct way to remove a symlink in QFile::remove and QDir::remove/removeRecursively)
This ticket collects the various relevant bugs in Qt.
Attachments
Issue Links
- relates to
-
QTBUG-44482 QDir won't read directory pointed to by a Windows shortcut
- Closed
-
QTBUG-77523 QFileInfo::size() reports the size of symlink target instead of the link file itself, contrary to the documentation
- Closed
-
QTBUG-93869 Implement QFileInfo::junctionTarget(), QFile::junctionTarget()
- Closed
- resulted from
-
QTBUG-24831 QFile/QFileInfo function size() wrong for symlinks(WIN)
- Closed
-
QTBUG-45344 Qt doesn't treat junction points as symlinks.
- Closed
-
QTBUG-44639 Support real symbolic links on Windows
- Blocked