From 78a1de612e7a89f55b52d79969b53e672edb8306 Mon Sep 17 00:00:00 2001 From: Dan Church Date: Wed, 21 Dec 2022 13:19:00 -0600 Subject: [PATCH] Only detect binaries with execution permission If for instance a program was in PATH and the file was marked non-executable (`chmod -x`), `find_binary` it would still pick it up as executable. --- waflib/Configure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/waflib/Configure.py b/waflib/Configure.py index f6fdc4e9..763f4668 100644 --- a/waflib/Configure.py +++ b/waflib/Configure.py @@ -496,12 +496,12 @@ def find_binary(self, filenames, exts, paths): for ext in exts: exe_name = f + ext if os.path.isabs(exe_name): - if os.path.isfile(exe_name): + if os.path.isfile(exe_name) and os.access(x, os.X_OK): return exe_name else: for path in paths: x = os.path.expanduser(os.path.join(path, exe_name)) - if os.path.isfile(x): + if os.path.isfile(x) and os.access(x, os.X_OK): return x return None