Changes between Initial Version and Version 1 of Ticket #30807, comment 3


Ignore:
Timestamp:
Sep 29, 2019, 5:53:52 AM (5 years ago)
Author:
Ad Timmering

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30807, comment 3

    initial v1  
    66
    77* The reason this works is because `django.utils.archive.BaseArchive` has a method called `_copy_permissions` that only reflects permissions **if** the file in the archive at least has 0o4 (owner-read, defined in `stat.S_IROTH`). Because this file has no permissions (also no user read), permissions are not correctly updated to reflect permissions in the archive.
     8
     9(Not sure I understand intent of the comment added in the method:/)
     10
     11{{{
     12    @staticmethod
     13    def _copy_permissions(mode, filename):
     14        """
     15        If the file in the archive has some permissions (this assumes a file
     16        won't be writable/executable without being readable), apply those
     17        permissions to the unarchived file.
     18        """
     19        if mode & stat.S_IROTH:
     20            os.chmod(filename, mode)
     21}}}
Back to Top