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

QDir::canonicalPath produce wrong path when a symbolic link to a UNC directory is in the part

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Not Evaluated Not Evaluated
    • 5.12.4
    • 4.8.4
    • Core: I/O
    • None
    • Windows 7
    • 3f17029aa12eafd3f8ddd5e0b246a6bf22eabfe3

      If you create a symbolic link on Windows 7 to a UNC path

      mklink /d link \\server\share\dir

      then use QDir()::canonicalPath to get the expanded path this is wrong. The issue is the code of readSymLink this uses DeviceIoControl to get the value of
      the link. When a UNC path is used the result is ??\UNC\server\share\dir and the code current does not remove the UNC and replace by \. This result in the returned path being incorrect.

      A possible fix is to do something like

      if(result.startsWith(QLatin1String("\\??\\UNC
      ")))

      { result = result.mid(7); result.prepend(QLatin1Char('\\')); }

      The 5.0 code seems to have the same problem

        For Gerrit Dashboard: QTBUG-30401
        # Subject Branch Project Status CR V

            vhilshei Volker Hilsheimer
            simongrist Simon Grist
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes