[cmake-developers] Proposed change to behavior of find_program

Brad King brad.king at kitware.com
Mon Dec 22 09:38:22 EST 2014


On 12/19/2014 06:25 PM, Thompson, KT wrote:
> Hmm.  It looks my original proposal breaks some backward compatibility.
[snip]
> @@ -1148,13 +1148,13 @@ bool SystemTools::FileExists(const kwsys_stl::string& filename)
[snip]
> -  return access(filename.c_str(), R_OK) == 0;
> +  return access(filename.c_str(), R_OK) == 0 || access(filename.c_str(), X_OK) == 0;

The issue your patch tries to address is tracked here:

 http://www.cmake.org/Bug/view.php?id=10468

However, there is a deeper issue discussed here:

 http://www.cmake.org/Bug/view.php?id=14022

Basically "access" is not the right way to implement FileExists.
If we're going to change it at all, the change should make it do
the right thing.  See comments in issue 14022 for details.

Unfortunately the full fix likely requires an audit of all FileExists
call sites to determine which ones need to be just lstat and which
ones care about permissions too.

-Brad


More information about the cmake-developers mailing list