[cmake-developers] [CMake 0014192]: get_filename_component(REALPATH) doesn't resolve symlink if the file doesn't exists.

Mantis Bug Tracker mantis at public.kitware.com
Tue Jun 4 01:00:24 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14192 
====================================================================== 
Reported By:                Yichao Yu
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14192
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-06-04 01:00 EDT
Last Modified:              2013-06-04 01:00 EDT
====================================================================== 
Summary:                    get_filename_component(REALPATH) doesn't resolve
symlink if the file doesn't exists.
Description: 
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.


Steps to Reproduce: 
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

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-06-04 01:00 Yichao Yu      New Issue                                    
======================================================================




More information about the cmake-developers mailing list