diff -r a85606b6de32 Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst Mon Apr 14 14:32:20 2014 -0400 +++ b/Doc/library/zipfile.rst Mon Apr 14 18:50:32 2014 -0400 @@ -196,7 +196,6 @@ Return a list of archive members by name. - .. index:: single: universal newlines; zipfile.ZipFile.open method @@ -256,6 +255,11 @@ characters (``:``, ``<``, ``>``, ``|``, ``"``, ``?``, and ``*``) replaced by underscore (``_``). + .. note:: + + File permissions are not passed to the extracted file. The extracted + file will use the users umask instead of the source files permissions. + .. method:: ZipFile.extractall(path=None, members=None, pwd=None) @@ -272,6 +276,10 @@ dots ``".."``. This module attempts to prevent that. See :meth:`extract` note. + .. note:: + + File permissions are not passed to the extracted file. The extracted + file will use the users umask instead of the source files permissions. .. method:: ZipFile.printdir() @@ -349,6 +357,15 @@ member of the given :class:`ZipInfo` instance. By default, the :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`. + .. note:: + + The compressed file permissions will default to 0600 unless + ZipInfo.external_attr is set before ZipFile.writestr is called. + + example: + + ZipInfo.external_attr = 0777 << 16L #give full access to zipped file. + .. versionchanged:: 3.2 The *compress_type* argument. diff -r a85606b6de32 Lib/zipfile.py --- a/Lib/zipfile.py Mon Apr 14 14:32:20 2014 -0400 +++ b/Lib/zipfile.py Mon Apr 14 18:50:32 2014 -0400 @@ -1218,6 +1218,8 @@ using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a ZipInfo object. You can specify a different directory using `path'. + + Ignores target files permissions, uses user umask. """ if not isinstance(member, ZipInfo): member = self.getinfo(member) @@ -1232,6 +1234,8 @@ directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist(). + + Ignores target files permissions, uses user umask. """ if members is None: members = self.namelist() @@ -1257,6 +1261,8 @@ def _extract_member(self, member, targetpath, pwd): """Extract the ZipInfo object 'member' to a physical file on the path targetpath. + + Ignores target files permissions, uses user umask. """ # build the destination pathname, replacing # forward slashes to platform specific separators. @@ -1405,7 +1411,12 @@ may be either a 'str' or a 'bytes' instance; if it is a 'str', it is encoded as UTF-8 first. 'zinfo_or_arcname' is either a ZipInfo instance or - the name of the file in the archive.""" + the name of the file in the archive. + + The compressed file permissions default to 0600 unless + ZipInfo.external_attr is set before ZipFile.writerstr is + called. + """ if isinstance(data, str): data = data.encode("utf-8") if not isinstance(zinfo_or_arcname, ZipInfo):