Use correct permission mask when checking if files can be executed
Do not filter potential commands by executability

This was a very loose heuristic - didn't check whether the user the
command was currently being run as had permission to execute the
program.