[cmake-developers] [CMake 0014193]: get_filename_component(ABSOLUTE) doesn't remove multiple leading /
Mantis Bug Tracker
mantis at public.kitware.com
Tue Jun 4 01:54:36 EDT 2013
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=14193
======================================================================
Reported By: Yichao Yu
Assigned To:
======================================================================
Project: CMake
Issue ID: 14193
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2013-06-04 01:54 EDT
Last Modified: 2013-06-04 01:54 EDT
======================================================================
Summary: get_filename_component(ABSOLUTE) doesn't remove
multiple leading /
Description:
When given a path with multiple leading /'s, get_filename_component returns a
filename with two leading /'s.
Although this behavior is consistent with how cd set PWD (see 8.c of cd(1)[1]),
it doesn't consistent with realpath(1) and realpath(3). And it also makes it
harder to use this absolute path as an unique identifier of the file directly.
Non-posix shell like zsh(1) also removes multiple leading /'s in PWD and I
personally don't see any advantage of not removing them.
The same thing applies to get_filename_component(REALPATH) when a not-yet-exists
path is given. (probably related to http://www.cmake.org/Bug/view.php?id=14192.)
[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html
Steps to Reproduce:
get_filename_component(abs_path "//lib" ABSOLUTE)
message("${abs_path}")
expected output:
/lib
actual output:
//lib
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2013-06-04 01:54 Yichao Yu New Issue
======================================================================
More information about the cmake-developers
mailing list