Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.5.1, 5.9.9
-
None
Description
In Linux system, QFile::exists() / QDir::exists() / QFile::open() / QDir::rmdir() and other functions have the same problem. If the file path contains "..", when the sub file does not exist, its upper level directory is also determined as nonexistent, such as "local /. / bin". If "bin" does not exist, "local" is judged as nonexistent / cannot be opened / deleted.
QDir dir(""/home/hanyi/Work/NoExists/../Tree2"");
//"/home/hanyi/Work/Tree2" is exist, "NoExists" is not exist
bool bValue = dir.exists(); //return false
In Windows system, it is no problem to transfer parameters in this way. The difference between the two is that:
In the QFileSystemEntry::resolveNativeFilePath() function, the
QFSFileEnginePrivate::longFileName --》 GetFullPathName correctly handles the path containing.. /. Under Linux system, nothing is done.
I understand that in this function, the path containing ".." should be processed by using QDir::cleanPath.