Skip to content

Commit

Permalink
Check executability in exec lookup (#2489)
Browse files Browse the repository at this point in the history
Fix #2489. Nothing guarantees that files in the PATH are executable, and
Unix utilities handle this just fine.
  • Loading branch information
Blaisorblade committed Aug 16, 2016
1 parent 5d712bc commit 633ac50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/System/Process/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ findExecutable eo name = liftIO $ do
testFPs [] = loop dirs
testFPs (fp:fps) = do
exists <- D.doesFileExist fp
if exists
existsExec <- if exists then liftM D.executable $ D.getPermissions fp else return False
if existsExec
then do
fp' <- D.makeAbsolute fp >>= parseAbsFile
return $ return fp'
Expand Down

0 comments on commit 633ac50

Please sign in to comment.