Loading buildstream/plugins/sources/remote.py +5 −3 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ remote - stage files from remote urls """ import os import stat from buildstream import SourceError, utils from ._downloadablefilesource import DownloadableFileSource Loading Loading @@ -85,9 +84,12 @@ class RemoteSource(DownloadableFileSource): utils.safe_copy(self._get_mirror_file(), dest) # To prevent user's umask introducing variability here, explicitly set # file modes. if self.executable: st = os.stat(dest) os.chmod(dest, st.st_mode | stat.S_IEXEC) os.chmod(dest, 0o755) else: os.chmod(dest, 0o644) def setup(): Loading tests/sources/remote.py +9 −4 Original line number Diff line number Diff line Loading @@ -86,7 +86,11 @@ def test_simple_file_build(cli, tmpdir, datafiles): checkout_file = os.path.join(checkoutdir, 'file') assert(os.path.exists(checkout_file)) assert(not (os.stat(checkout_file).st_mode & stat.S_IEXEC)) mode = os.stat(checkout_file).st_mode # Assert not executable by anyone assert(not (mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH))) # Assert not writeable by anyone other than me assert(not (mode & (stat.S_IWGRP | stat.S_IWOTH))) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'single-file-custom-name')) Loading Loading @@ -156,6 +160,7 @@ def test_executable(cli, tmpdir, datafiles): result = cli.run(project=project, args=[ 'checkout', 'target-custom-executable.bst', checkoutdir ]) assert (os.stat( os.path.join(checkoutdir, 'some-custom-file')).st_mode & stat.S_IEXEC) mode = os.stat(os.path.join(checkoutdir, 'some-custom-file')).st_mode assert (mode & stat.S_IEXEC) # Assert executable by anyone assert(mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)) Loading
buildstream/plugins/sources/remote.py +5 −3 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ remote - stage files from remote urls """ import os import stat from buildstream import SourceError, utils from ._downloadablefilesource import DownloadableFileSource Loading Loading @@ -85,9 +84,12 @@ class RemoteSource(DownloadableFileSource): utils.safe_copy(self._get_mirror_file(), dest) # To prevent user's umask introducing variability here, explicitly set # file modes. if self.executable: st = os.stat(dest) os.chmod(dest, st.st_mode | stat.S_IEXEC) os.chmod(dest, 0o755) else: os.chmod(dest, 0o644) def setup(): Loading
tests/sources/remote.py +9 −4 Original line number Diff line number Diff line Loading @@ -86,7 +86,11 @@ def test_simple_file_build(cli, tmpdir, datafiles): checkout_file = os.path.join(checkoutdir, 'file') assert(os.path.exists(checkout_file)) assert(not (os.stat(checkout_file).st_mode & stat.S_IEXEC)) mode = os.stat(checkout_file).st_mode # Assert not executable by anyone assert(not (mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH))) # Assert not writeable by anyone other than me assert(not (mode & (stat.S_IWGRP | stat.S_IWOTH))) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'single-file-custom-name')) Loading Loading @@ -156,6 +160,7 @@ def test_executable(cli, tmpdir, datafiles): result = cli.run(project=project, args=[ 'checkout', 'target-custom-executable.bst', checkoutdir ]) assert (os.stat( os.path.join(checkoutdir, 'some-custom-file')).st_mode & stat.S_IEXEC) mode = os.stat(os.path.join(checkoutdir, 'some-custom-file')).st_mode assert (mode & stat.S_IEXEC) # Assert executable by anyone assert(mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH))