From aab2449b2b00535dab9ae65aa3ecadaaa8b0f51f Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 29 Nov 2013 15:50:49 +0100 Subject: [PATCH] [entropy.qa] _is_elf_executable_or_library: add allow_symlink keyword arg --- lib/entropy/qa.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/entropy/qa.py b/lib/entropy/qa.py index 776c9def1..b4c388d8a 100644 --- a/lib/entropy/qa.py +++ b/lib/entropy/qa.py @@ -1074,12 +1074,14 @@ class QAInterface(TextInterface, EntropyPluginStore): return broken_libs - def _is_elf_executable_or_library(self, path): + def _is_elf_executable_or_library(self, path, allow_symlink = True): """ Determine whether a path is a valid ELF executable or ELF library. @param path: path to test @type path: string + @keyword allow_symlink: True, if you accept symlinks + @type allow_symlink: bool @return: True, if yes @rtype: bool """ @@ -1095,6 +1097,10 @@ class QAInterface(TextInterface, EntropyPluginStore): if not stat.S_ISREG(st.st_mode): return False + if not allow_symlink: + if stat.S_ISLNK(st.st_mode): + return False + # shared libraries must be always executable if not (stat.S_IMODE(st.st_mode) & stat.S_IXUSR): return False