Bug 1168231 - Normalize file mode in jars. r=gps

This commit is contained in:
Mike Hommey 2015-05-26 08:12:43 +09:00 committed by Mike Hommey
parent 9bf7b6e99e
commit 91f38690b4

View File

@ -212,7 +212,20 @@ class File(BaseFile):
if platform.system() == 'Windows':
return None
assert self.path is not None
return os.stat(self.path).st_mode
mode = os.stat(self.path).st_mode
# Normalize file mode:
# - keep file type (e.g. S_IFREG)
ret = stat.S_IFMT(mode)
# - expand user read and execute permissions to everyone
if mode & 0400:
ret |= 0444
if mode & 0100:
ret |= 0111
# - keep user write permissions
if mode & 0200:
ret |= 0200
# - leave away sticky bit, setuid, setgid
return ret
class ExecutableFile(File):
'''