MantisBT - CMake
View Issue Details
0014192CMakeCMakepublic2013-06-04 01:002013-11-04 09:33
Yichao Yu 
 
normalminoralways
closedwon't fix 
LinuxArch Linux
CMake 2.8.11 
 
0014192: get_filename_component(REALPATH) doesn't resolve symlink if the file doesn't exists.
get_filename_component(REALPATH) doesn't resolve any intermediate symlinks if the file does not exist. This means the function can return different value on a output file before and after the build (which may be a minor problem in some cases) and is also not consistent with realpath(1) or realpath(3), which will resolve symlinks from the beginning until the path that is not exist.
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink /tmp tmp
  WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
get_filename_component(real_path "tmp/not-exist-file" REALPATH)
message("${real_path}")
file(REMOVE tmp)

expected output:
/tmp/not-exist-file

actual output:
....(what ever CMAKE_CURRENT_SOURCE_DIR is).../tmp/not-exist-file
No tags attached.
related to 0014091closed Brad King get_filename_component PATH docs and parameter naming kinda suck 
Issue History
2013-06-04 01:00Yichao YuNew Issue
2013-06-04 08:04Brad KingRelationship addedrelated to 0014091
2013-06-04 08:07Brad KingNote Added: 0033221
2013-06-04 08:07Brad KingStatusnew => resolved
2013-06-04 08:07Brad KingResolutionopen => won't fix
2013-11-04 09:33Robert MaynardNote Added: 0034359
2013-11-04 09:33Robert MaynardStatusresolved => closed

Notes
(0033221)
Brad King   
2013-06-04 08:07   
The realpath primitive is not guaranteed to resolve any symlinks when the final destination does not exist. Since 2.8.11 was released we've updated the documentation:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df71f968 [^]

to state that the file must exist for REALPATH to work.
(0034359)
Robert Maynard   
2013-11-04 09:33   
Closing resolved issues that have not been updated in more than 4 months.