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

QDir::removeRecursively() fails for directories managed by OneDrive

    XMLWordPrintable

Details

    • Windows

    Description

      QDir::removeRecursively() fails in removing directories managed by OneDrive.

      This is due to a permission operation by OneDrive.

       

      Steps to reproduce the issue:

      1. Stop OneDrive synchronization.

      2. Run the attached reproducer, click "Create folders", and select a directory managed by OneDrive. Click "Select folder" to create a nested folders there.

      3. Click "Show directory info" and select one of the created directories. Its permissions will be like :

      permissions QFlags(0x1|0x2|0x4|0x10|0x20|0x40|0x100|0x200|0x400|0x1000|0x2000|0x4000)

       

      4. Enable OneDrive synchronization and ensure that the created directories are synchronized (marked as "Always keep on this device", a green check mark).

      5. Click "Show directory info" and select the same directory as step 3. Its permissions will be like :

      permissions QFlags(0x1|0x4|0x10|0x40|0x100|0x200|0x400|0x1000|0x4000)

       

      6. Click "Remove folder (recursively)" and select the top directory of the created directories. It will fail.

      7. Click "Set WriteOwner permission" and select the top directory of the created directories, to change their permission. 

      8. Again, click "Remove folder (recursively)" and select the top directory of the created directories. It will go well this time.

       

      As shown above, OneDrive deprives 0x0002(WriteOther), 0x0020(WriteGroup), and 0x2000(WriteOwner) from the permissions of the directories that a Qt application created.

      So the application fails to remove the directories under OneDrive, even they are created by the application itself. 

       

      Workaround:

      Calling QFile::setPermissions() to set  WriteOwner permission to them again.

       

      Questions/Requests:

      • May I think this is a responsibility for OneDrive and there is no need to fix Qt API?
      • Is the workaround above the best way for this issue? Please share If there are some better ways.
      • Is it possible for Qt Document to describe this issue and the workaround to urge users to take precautions?

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            hitoshiito Hitoshi Ito
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes