From abf65c92af298683fa9ffa5e360ce6c836a1d2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 17 Aug 2018 04:02:23 +0200 Subject: minstall: use follow_symlinks to check executable This could happen when setting an default install mode but with broken symlinks. Fixes #3914 --- mesonbuild/minstall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mesonbuild/minstall.py') 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) -- cgit v1.1