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

Permissions are not stored properly in the ZIP archive (QZipReader/QZipWriter)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.5.0, 5.5.1, 5.6.0, 5.6.1, 5.7.0
    • Core: Other
    • None
    • Try on linux only. Not checked on others platforms

    Description

      Bug 1
      Permissions QFile::ExeUser and QFile::ExeOwner are not stored properly in the ZIP archive (QZipReader/QZipWriter class)

      Consequence: During the decompression of the archive with QZipReader::extractAll() function files and folders lost the attribute QFile::ExeOwner and QFile:ExeUser that is particularly disturbing for folders: extractAll() function failed to decompress files included in sub folder and returns false.

      BugFix:
      Edit function permissionsToMode() present in file qzip.cpp
      Replace the following lines
      if (perms & (QFile::ExeOwner | QFile::ExeUser))
      mode |= UnixFileAttributes::WriteUser;
      By
      if (perms & (QFile::ExeOwner | QFile::ExeUser))
      mode |= UnixFileAttributes::ExeUser; // BugFix

      Note: This function does not affect Qt5.4 because the permissionsToMode() function is coded differently.

      Bug 2
      Case 1
      If you create an archive and add some directories path (like /dir/subdir/subsubdir) without create parent directories before, you get permission wrong on parent directories

      zipWriter.setCreationPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner);
      zipWriter.addDirectory("dir/subdir/subsubdir");

      --> Extraction work. Only subsubdir will have a chmod 700 and parent directories will have chmod 755.

      Case 2
      zipWriter.setCreationPermissions(QFile::ReadOwner | QFile::WriteOwner);
      QFile file2("ZIP_Spec/2004-04-26_PKZIP_v6.2.0.txt");
      zipWriter.addFile("dir2/subdir/subsubdir/file2.txt", &file2);

      --> Extraction failed, no directory will be created

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            jirauser41371 user-d5128 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes