[Patches] [ python-Patches-1507247 ] tarfile extraction does not honor umask

SourceForge.net noreply at sourceforge.net
Fri Jun 16 14:11:20 CEST 2006


Patches item #1507247, was opened at 2006-06-16 15:11
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1507247&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Faik Uygur (faik)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile extraction does not honor umask

Initial Comment:
If the upperdirs in the member file's pathname does not 
exist. tarfile creates those paths with 0777 permission 
bits and does not honor umask.

This patch uses umask to set the ti.mode of the created 
directory for later usage in chmod.

--- tarfile.py  (revision 46993)
+++ tarfile.py  (working copy)
@@ -1560,7 +1560,9 @@
             ti = TarInfo()
             ti.name  = upperdirs
             ti.type  = DIRTYPE
-            ti.mode  = 0777
+            umask = os.umask(0)
+            ti.mode  = 0777 - umask
+            os.umask(umask)
             ti.mtime = tarinfo.mtime
             ti.uid   = tarinfo.uid
             ti.gid   = tarinfo.gid


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1507247&group_id=5470


More information about the Patches mailing list