Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7036

QFileInfo::canonicalPath() produces wrong results for NTFS junction points

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.7.0
    • 4.6.0, 4.6.1, 4.6.2
    • Core: I/O
    • None
    • Windows 7 x64
      Windows XP
      Windows 2000
    • b4996ab8e3a26d45ee55593da281e4b798c04dd2

    Description

      With Qt 4.6.0 QFileInfo::canonicalPath() no longer produces the right output for NTFS junction points.

      My configuration (both Win2k and Win7x64) is:

      • (hd0,0) -> C:
      • (hd0,1) -> D: AND C:\Users\Username

      I. e. (hd0,1) is also mounted on my user's profile directory.
      When I try to get a canonical path of some C:\Users\Username\path\to\file the result is Volume

      { ### }\path\to\file, where ### is the id of the D: volume; it is a sequence of 8-4-4-4-12 hex digits. And of course this canonicalized path is not understood by any other Qt class or method, nor any other application.

      It seems like the file "C:\Users\Username" is considered as a symlink, i. e. QFileInfo::isSymlink() returns true and QFileInfo::target() returns "Volume{ ### }

      ", so during the canonicalization the filename becomes as said above. With previous Qt version this was not true, it was not considered as a symlink.
      I am not sure whether that kind of path should be considered a symlink or not, anyway now it does not work.
      I have also found this page http://support.microsoft.com/kb/205524/en-us that says that the true target should be \\?\Volume

      {###}

      , with the leading \ \ ? \

      For now I found a workaround by reverting the QFileInfo implementation back as the 4.5.3 one. Actually I simply commented out these four lines in file src/corelib/io/qfsfileengine_win.cpp

      src/corelib/io/qfsfileengine_win.cpp
      // Lines 1585 - 1586:
      //            if ((type & LinkType) && d->isSymlink())
      //                ret |= LinkType;
      
      // Lines 1699 - 1700:
      //        else if (d->doStat() && d->isSymlink())
      //            ret = readSymLink(d->filePath);
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              biochimia João Abecasis
              claudiom claudio mattera
              Votes:
              8 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes