Patches item #1507247, was opened at 2006-06-16 14:11 Message generated for change (Comment added) made by gustaebel 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 Private: No Submitted By: Faik Uygur (faik) Assigned to: Lars Gustäbel (gustaebel) 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 ---------------------------------------------------------------------- >Comment By: Lars Gustäbel (gustaebel) Date: 2006-12-30 13:11 Message: Logged In: YES user_id=642936 Originator: NO In order to determine the current umask we have no other choice AFAIK than to set it with a bogus value, save the return value and restore it right away - as you proposed in your patch. The problem is that there is a small window of time between these two calls where the umask is invalid. This is especially bad in multi-threaded environments. Any ideas? ---------------------------------------------------------------------- Comment By: Han-Wen Nienhuys (hanwen) Date: 2006-12-06 00:40 Message: Logged In: YES user_id=161998 Originator: NO Hi, I can reproduce this problem on python 2.4 , and patch applies to python 2.5 too. Fix looks good to me. ---------------------------------------------------------------------- Comment By: Faik Uygur (faik) Date: 2006-08-18 11:44 Message: Logged In: YES user_id=1541018 Above patch is wrong. The correct one is attached. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1507247&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches