View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014022 | CMake | CMake | public | 2013-03-18 10:40 | 2016-06-10 14:31 | ||||
Reporter | Petr Kmoch | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Unix | OS | OS Version | ||||||
Product Version | CMake 2.8.9 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014022: if(EXISTS) returns false for broken symlinks | ||||||||
Description | 'if(EXISTS arg)' evaluates to false if 'arg' is a symlink pointing to a non-existent file. To me, this feels like incorrect behaviour - arg itself exists, so the test should pass. If the current behaviour is actually intended, I believe it should at least be documented. With Windows symlinks, this does not happen; 'if(EXISTS arg)' evaluates to true if 'arg' is a broken link created with 'mklink'. | ||||||||
Steps To Reproduce | $ ln -s target link $ cmake -P test_link.cmake (attached) $ touch target $ cmake -P test_link.cmake 'link' exists in both cases, but first run reports 'link does not exist' | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | test_link.cmake [^] (114 bytes) 2013-03-18 10:40 | ||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0032656) Brad King (manager) 2013-03-18 11:05 |
This is because the SystemTools::FileExists method: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/kwsys/SystemTools.cxx;hb=v2.8.10.2#l1080 [^] uses "access" instead of "lstat" because someone once thought it was faster and so that find_* commands would only find readable files: http://public.kitware.com/gitweb?p=KWSys.git;a=commitdiff;h=4b0eccba [^] http://public.kitware.com/gitweb?p=KWSys.git;a=commitdiff;h=9fa7573f [^] However, "access" should not be used for this purpose. Unfortunately it is hard to change now because many uses of FileExists have been introduced that assume its current behavior. Fixing this will require FileExists and all calls to it to be refactored into multiple functions that cover the actual needs of each call site. There are *many* such calls. |
(0032702) Brad King (manager) 2013-03-26 08:27 |
At least some code relies on if(EXISTS) returning false for a broken symlink: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/CMakeLists.txt;hb=v2.8.10.2#l2195 [^] http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=46c0a583 [^] Due to the historic "access()" implementation the if(EXISTS) check tests whether a file is readable. Any fix to this will have to preserve that, at least with a policy. |
(0035496) Ben Boeckel (developer) 2014-03-24 18:05 |
Would a policy or a new keyword (FILENAME_EXISTS) be better? |
(0035529) Brad King (manager) 2014-03-26 11:02 |
Re 0014022:0035496: I think a policy would be better. It will avoid carrying two almost identical interfaces and having to document the subtle difference. |
(0042253) Kitware Robot (administrator) 2016-06-10 14:28 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-03-18 10:40 | Petr Kmoch | New Issue | |
2013-03-18 10:40 | Petr Kmoch | File Added: test_link.cmake | |
2013-03-18 10:57 | Brad King | Relationship added | related to 0010468 |
2013-03-18 11:05 | Brad King | Note Added: 0032656 | |
2013-03-18 11:05 | Brad King | Status | new => backlog |
2013-03-26 08:27 | Brad King | Note Added: 0032702 | |
2014-03-24 18:05 | Ben Boeckel | Note Added: 0035496 | |
2014-03-26 11:02 | Brad King | Note Added: 0035529 | |
2016-06-10 14:28 | Kitware Robot | Note Added: 0042253 | |
2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |