[llvm-commits] [llvm] r117596 - /llvm/trunk/lib/System/Unix/Program.inc

Dan Gohman gohman at apple.com
Thu Oct 28 17:28:12 PDT 2010


On Oct 28, 2010, at 1:57 PM, Mikhail Glushenkov wrote:

> Dan Gohman <gohman at ...> writes:
> 
>> 
>> Author: djg
>> Date: Thu Oct 28 15:34:33 2010
>> New Revision: 117596
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=117596&view=rev
>> Log:
>> Revert r117582, which reverted r77396. Searching PATH for a string
>> which contains slashes is inconsistent with the meaning of PATH on
>> Unix-type platforms, and pretty surprising.
> 
> Thanks, I've missed this. What about changing
> 
>  if (progName.find('/') != std::string::npos && temp.canExecute())
>    return temp;
> 
> to
> 
>  if (progName.find('/') != std::string::npos) {
>    if (temp.canExecute())
>      return temp;
>    else
>      return Path();
>  }
> 
> This would be consistent with the Win32 version.

This would prevent clients from being able to distinguish
between "not found" and "not executable".

> Alternatively, we can change FindExecutable to take into account that canExecute
> can be false for the path returned by FindProgramByName.


My assumption is that it's perfectly acceptable for FindExecutable
to return a non-executable path here; its caller will attempt to
execute the path, get an error, and report the error to the user,

What problem are you trying to solve here?

Dan





More information about the llvm-commits mailing list