diff options
author | George Hartzell <hartzell@alerce.com> | 2017-04-06 14:25:13 -0700 |
---|---|---|
committer | Adam J. Stewart <ajstewart426@gmail.com> | 2017-04-06 16:25:13 -0500 |
commit | 84208523f9d4f6d35bbf732e4276d583a37ff911 (patch) | |
tree | a003776314e943b0cd40c4e1d0269ebfecdd0510 | |
parent | a526bcaf117c1dd83c9fdd0fd85464aba57bb064 (diff) | |
download | spack-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.
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 10 |
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): |