Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9
-
None
-
-
3f17029aa12eafd3f8ddd5e0b246a6bf22eabfe3 (qt/qtbase/5.12)
Description
This tickets ties various related bug reports together.
The various methods in QFile/QFileInfo/QDir that try to interpret symbolic links on NTFS in general, and links to UNC paths in particular, are buggy and inconsistent. Windows API specific file name tagging with ?\, ??\, or \\?\UNC\ (which is supposed to enable paths that exceed MAX_PATH) sometimes leaks through Qt APIs to the application code, even though it should be entirely invisible to Qt API users.
As a general requirement for a fix, Qt APIs that interpret paths or follow links should
- always generate paths that can be used in other QFile, QDir, etc APIs (ie c:\dir\file is ok; \\server\share\file is ok; ?\server\share\file is not ok)
- never leak Windows API specific tagging to the API user
The attached code prints
This is what I know about c:\Users\host - fileInfo.isAbsolute true - fileInfo.absoluteFilePath C:/Users/host - fileInfo.canonicalPath C:/Users/UNC/VBOXSRV - fileInfo.canonicalFilePath C:/Users/UNC/VBOXSRV/host - fileInfo.isSymLink true - fileInfo.symLinkTarget C:/Users/UNC/VBOXSRV/host - fileInfo.isDir true - entry count: 19 - dir.canonicalPath C:/Users/UNC/VBOXSRV/host - QDir::toNativeSeperators c:\Users\host - QDir::cleanPath c:/Users/host - storageInfo.rootPath C:/
where c:\Users\host is created with
mklink /D c:\Users\host \\VBOXSRV\host
Attachments
Issue Links
- Is tested by
-
QTBUG-30401 QDir::canonicalPath produce wrong path when a symbolic link to a UNC directory is in the part
- Closed
-
QTBUG-20791 QFileInfo.canonicalFilePath is wrong on symlink on NTFS volume
- Closed
-
QTBUG-48048 QDir::canonicalPath() fails with NTFS symbolic link to network path
- Closed
-
QTBUG-62665 Imports aren't properly resolved from UNC paths containing symlinks on Windows
- Closed
-
QTBUG-63970 QFileInfo::canonicalPath() does not works right on WIndows symlinks to UNC paths
- Closed
- mentioned in
-
Page Loading...