summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit
diff options
context:
space:
mode:
authorDan Liew <dan@su-root.co.uk>2015-11-13 11:37:25 +0000
committerDan Liew <dan@su-root.co.uk>2015-11-13 11:37:25 +0000
commit82bd29b13c3c2cec45c40cea63a264ab73ecc5a3 (patch)
treef0a4e1e7a00de64c235cb2fb8351f907583ffe51 /llvm/utils/lit
parent33e73458861f66d3bdecf4c45a7f60c1f51ebb10 (diff)
downloadbcm5719-llvm-82bd29b13c3c2cec45c40cea63a264ab73ecc5a3.tar.gz
bcm5719-llvm-82bd29b13c3c2cec45c40cea63a264ab73ecc5a3.zip
[lit] Fix bug where ``lit.util.which()`` would return a directory
instead of executable if the argument was found inside a directory contained in PATH. An example where this could cause a problem is if there was a RUN line that ran the ``test`` command and if the user had a directory in their PATH that contained a directory called ``test/`` (that occured before ``/usr/bin/``). Lit would try to use the directory as the executable which would fail with the rather cryptic message. ``` Could not create process due to [Errno 13] Permission denied ``` llvm-svn: 253031
Diffstat (limited to 'llvm/utils/lit')
-rw-r--r--llvm/utils/lit/lit/util.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index a4233bac7aa..224509ab840 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -94,7 +94,7 @@ def which(command, paths = None):
for path in paths.split(os.pathsep):
for ext in pathext:
p = os.path.join(path, command + ext)
- if os.path.exists(p):
+ if os.path.exists(p) and not os.path.isdir(p):
return p
return None
OpenPOWER on IntegriCloud