aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/minstall.py
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2018-08-17 04:02:23 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2018-08-17 16:41:09 +0200
commitabf65c92af298683fa9ffa5e360ce6c836a1d2fa (patch)
treefea0cbb8cb3aecb491a3802350cae69934e83c8d /mesonbuild/minstall.py
parent5de2a7910aafb39940789f5dbed244c230624917 (diff)
downloadmeson-abf65c92af298683fa9ffa5e360ce6c836a1d2fa.zip
meson-abf65c92af298683fa9ffa5e360ce6c836a1d2fa.tar.gz
meson-abf65c92af298683fa9ffa5e360ce6c836a1d2fa.tar.bz2
minstall: use follow_symlinks to check executable
This could happen when setting an default install mode but with broken symlinks. Fixes #3914
Diffstat (limited to 'mesonbuild/minstall.py')
-rw-r--r--mesonbuild/minstall.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 3ae1199..748f06b 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -69,9 +69,9 @@ class DirMaker:
for d in self.dirs:
append_to_log(self.lf, d)
-def is_executable(path):
+def is_executable(path, follow_symlinks=False):
'''Checks whether any of the "x" bits are set in the source file mode.'''
- return bool(os.stat(path).st_mode & 0o111)
+ return bool(os.stat(path, follow_symlinks=follow_symlinks).st_mode & 0o111)
def append_to_log(lf, line):
lf.write(line)
@@ -107,7 +107,7 @@ def set_chmod(path, mode, dir_fd=None, follow_symlinks=True):
def sanitize_permissions(path, umask):
if umask is None:
return
- new_perms = 0o777 if is_executable(path) else 0o666
+ new_perms = 0o777 if is_executable(path, follow_symlinks=False) else 0o666
new_perms &= ~umask
try:
set_chmod(path, new_perms, follow_symlinks=False)