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.
This commit is contained in:
parent
a526bcaf11
commit
84208523f9
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user