if findExecutable finds a file that matchs the argument, check if it is an executable
|Reported by:||iago||Owned by:||leroux|
|Keywords:||findExecutable check executable||Cc:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Revisions:|
When search finds a file that matchs with the fileName argument of findExecutable, it doesn't check if the file is an executable file.
do path <- getEnv "PATH" search (splitSearchPath path) where fileName = binary <.> exeExtension search :: [FilePath] -> IO (Maybe FilePath) search  = return Nothing search (d:ds) = do let path = d </> fileName b <- doesFileExist path if b then return (Just path) else search ds
findExecutable mustn't returns a file that it isn't an executable file, for example
(~/bin is in PATH variable)
$ touch ~/bin/foofile $ ghci $ :m System.Directory $ findExecutable "foofile"
shows that findExecutable returns IO (Just "/home/iago/bin/foofile").
Altought is not a bug, could be good add a new funcion (findExecutables for example) to return all the executables in all the paths of PATH variable that matchs with a given filename (like which -a).
Change History (20)
comment:1 Changed 7 years ago by igloo
- difficulty set to Unknown
- Milestone set to 6.8.3
- Summary changed from if findExecutable finds a file that matchs the argument don't check if it is an executable to if findExecutable finds a file that matchs the argument, check if it is an executable
comment:5 Changed 5 years ago by igloo
- Milestone changed from 6.12.3 to 6.14.1
- Priority changed from normal to low
comment:9 Changed 3 years ago by igloo
- Milestone changed from 7.4.1 to 7.6.1
- Priority changed from low to lowest
Changed 21 months ago by leroux
Changed 20 months ago by leroux
comment:17 Changed 20 months ago by simonpj
- Milestone changed from 7.6.2 to 7.8.1
- Priority changed from normal to high