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

QFile::rename() deletes file and fails to rename on Windows/NFS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.8.0
    • Core: I/O
    • None
    • client: Windows 11 24H2 server:Ubuntu 20.04.6 LTS
    • Windows
    • 2defca418 (dev), ce820174e (6.9), 443758964 (6.8), 0aaf43ac2 (tqtc/lts-6.5)
    • Foundation Sprint 123

    Description

      If a case-sensitive filesystem is mounted case-insensitive (the default) via NFS on Windows, QFile::rename() will delete the source if the path matches the destination (case-insensitively).

      This is a problem, since the most common way to mount NFS exports (typically from Linux) is case-insensitively since it is more compatible with Windows applications, for example.

      mount -o anon \\192.168.0.1\mnt\share Z:
      

      Windows Explorer refuses to do such renames, instead we get a dialog: "Rename file: The source and destination file names are the same". Which implies it is possible to detect this condition in Qt.

      To work around the problem, we can mount case-sensitive:

      mount -o anon casesensitive=yes \\192.168.0.1\mnt\share Z:
      

      Attachments

        1. CMakeLists.txt
          2 kB
        2. cmd.log
          0.8 kB
        3. main.cpp
          0.3 kB

        Activity

          People

            manordheim MÃ¥rten Nordheim
            scrubbbbs John Dorian
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: