View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014192CMakeCMakepublic2013-06-04 01:002013-11-04 09:33
ReporterYichao Yu 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionwon't fix 
PlatformLinuxOSArch LinuxOS Version
Product VersionCMake 2.8.11 
Target VersionFixed in Version 
Summary0014192: get_filename_component(REALPATH) doesn't resolve symlink if the file doesn't exists.
Descriptionget_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 Reproduceexecute_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
TagsNo tags attached.
Attached Files

 Relationships
related to 0014091closedBrad King get_filename_component PATH docs and parameter naming kinda suck 

  Notes
(0033221)
Brad King (manager)
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 (manager)
2013-11-04 09:33

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-06-04 01:00 Yichao Yu New Issue
2013-06-04 08:04 Brad King Relationship added related to 0014091
2013-06-04 08:07 Brad King Note Added: 0033221
2013-06-04 08:07 Brad King Status new => resolved
2013-06-04 08:07 Brad King Resolution open => won't fix
2013-11-04 09:33 Robert Maynard Note Added: 0034359
2013-11-04 09:33 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team