summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGeorge Hartzell <hartzell@alerce.com>2017-04-06 14:25:13 -0700
committerAdam J. Stewart <ajstewart426@gmail.com>2017-04-06 16:25:13 -0500
commit84208523f9d4f6d35bbf732e4276d583a37ff911 (patch)
treea003776314e943b0cd40c4e1d0269ebfecdd0510 /lib
parenta526bcaf117c1dd83c9fdd0fd85464aba57bb064 (diff)
downloadspack-84208523f9d4f6d35bbf732e4276d583a37ff911.tar.gz
spack-84208523f9d4f6d35bbf732e4276d583a37ff911.tar.bz2
spack-84208523f9d4f6d35bbf732e4276d583a37ff911.tar.xz
spack-84208523f9d4f6d35bbf732e4276d583a37ff911.zip
set_executable can set S_IX{GRP,OTH} (#3742)
`set_executable` now checks if a user/group.other had read permission on a file and if it does then it sets the corresponding executable bit. See #1483.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/filesystem.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index 8922010e70..71d5096523 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -394,8 +394,14 @@ def traverse_tree(source_root, dest_root, rel_path='', **kwargs):
def set_executable(path):
- st = os.stat(path)
- os.chmod(path, st.st_mode | stat.S_IEXEC)
+ mode = os.stat(path).st_mode
+ if mode & stat.S_IRUSR:
+ mode |= stat.S_IXUSR
+ if mode & stat.S_IRGRP:
+ mode |= stat.S_IXGRP
+ if mode & stat.S_IROTH:
+ mode |= stat.S_IXOTH
+ os.chmod(path, mode)
def remove_dead_links(root):