2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00

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.
This commit is contained in:
Dan Church 2022-12-21 13:19:00 -06:00 committed by Waf Project
parent 50644394f6
commit 2689cc9518

View File

@ -499,12 +499,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