diff options
author | Jürg Billeter <j@bitron.ch> | 2020-04-07 14:19:05 +0200 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-04-08 06:57:57 +0000 |
commit | 8b093f9627d4bb2036ab9696f2fedf84e9f89063 (patch) | |
tree | 6e6bd982a8d9aa6c30180d8854b36ffb1440c800 | |
parent | 90c164693ee2eb32e05325c14219c9329d14c386 (diff) | |
download | buildstream-8b093f9627d4bb2036ab9696f2fedf84e9f89063.tar.gz |
_casbaseddirectory.py: Fix file mode in export_to_tar()
Bitwise-and of a boolean and `stat.S_IXUSR` is always 0.
Also, `is_executable` only applies to regular files, not symlinks.
-rw-r--r-- | src/buildstream/storage/_casbaseddirectory.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index ed6fe206c..43d5e8224 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -549,14 +549,15 @@ class CasBasedDirectory(Directory): source_name = self.cas_cache.objpath(entry.digest) tarinfo = tarfilelib.TarInfo(arcname) tarinfo.mtime = mtime - tarinfo.mode |= entry.is_executable & stat.S_IXUSR + if entry.is_executable: + tarinfo.mode |= stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH tarinfo.size = os.path.getsize(source_name) with open(source_name, "rb") as f: tarfile.addfile(tarinfo, f) elif entry.type == _FileType.SYMLINK: tarinfo = tarfilelib.TarInfo(arcname) tarinfo.mtime = mtime - tarinfo.mode |= entry.is_executable & stat.S_IXUSR + tarinfo.mode = 0o777 tarinfo.linkname = entry.target tarinfo.type = tarfilelib.SYMTYPE f = StringIO(entry.target) |