diff options
author | Valentin David <valentin.david@codethink.co.uk> | 2018-08-06 17:19:55 +0200 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-08-12 05:57:44 +0000 |
commit | 465909ddc6d39822f7669d554f3033e497b6f762 (patch) | |
tree | a256fc7889a91ba5cac5c7ee488edaf6c106785d | |
parent | b9f6b1d7f538c2c6e4b2f075c20d8f4a583e9120 (diff) | |
download | buildstream-465909ddc6d39822f7669d554f3033e497b6f762.tar.gz |
Use deterministic umask when staging sources.
This fix is applied to plugins bzr, git, patch.
Fixes #543 #544 #555.
-rw-r--r-- | buildstream/utils.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py index 68f99b9a3..9546f13cd 100644 --- a/buildstream/utils.py +++ b/buildstream/utils.py @@ -1010,6 +1010,15 @@ def _call(*popenargs, terminate=False, **kwargs): process = None + old_preexec_fn = kwargs.get('preexec_fn') + if 'preexec_fn' in kwargs: + del kwargs['preexec_fn'] + + def preexec_fn(): + os.umask(stat.S_IWGRP | stat.S_IWOTH) + if old_preexec_fn is not None: + old_preexec_fn() + # Handle termination, suspend and resume def kill_proc(): if process: @@ -1054,7 +1063,7 @@ def _call(*popenargs, terminate=False, **kwargs): os.killpg(group_id, signal.SIGCONT) with _signals.suspendable(suspend_proc, resume_proc), _signals.terminator(kill_proc): - process = subprocess.Popen(*popenargs, **kwargs) + process = subprocess.Popen(*popenargs, preexec_fn=preexec_fn, **kwargs) output, _ = process.communicate() exit_code = process.poll() |