summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-11-18 11:39:21 +0100
committerJürg Billeter <j@bitron.ch>2019-11-25 09:45:22 +0100
commit2762c9303954978ea42e6112827e466b6648d310 (patch)
tree08750e699c19877dc7dcea0a118ff720ff3406d3
parent470efb7ed68783eec0e70e8323ff48d1d7e55456 (diff)
downloadbuildstream-2762c9303954978ea42e6112827e466b6648d310.tar.gz
tar.py: Respect umask
This allows access by buildbox-casd running as different user.
-rw-r--r--src/buildstream/plugins/sources/tar.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/buildstream/plugins/sources/tar.py b/src/buildstream/plugins/sources/tar.py
index a5b84613e..e35b52f85 100644
--- a/src/buildstream/plugins/sources/tar.py
+++ b/src/buildstream/plugins/sources/tar.py
@@ -76,12 +76,13 @@ class ReadableTarInfo(tarfile.TarInfo):
@property
def mode(self):
- # ensure file is readable by owner, and executable
- # (=traversable) if it's a directory.
- if self.isdir():
- return self.__permission | 0o500
+ # Respect umask instead of the file mode stored in the archive.
+ # The only bit used from the embedded mode is the executable bit for files.
+ umask = utils.get_umask()
+ if self.isdir() or bool(self.__permission | 0o100):
+ return 0o777 & ~umask
else:
- return self.__permission | 0o400
+ return 0o666 & ~umask
@mode.setter
def mode(self, permission):