MantisBT - CMake
View Issue Details
0014193CMakeCMakepublic2013-06-04 01:542013-11-04 09:33
Yichao Yu 
 
normalminoralways
closedwon't fix 
LinuxArch Linux
CMake 2.8.11 
 
0014193: get_filename_component(ABSOLUTE) doesn't remove multiple leading /
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 0014192.)

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html [^]
get_filename_component(abs_path "//lib" ABSOLUTE)
message("${abs_path}")

expected output:
/lib

actual output:
//lib
No tags attached.
Issue History
2013-06-04 01:54Yichao YuNew Issue
2013-06-04 08:08Brad KingNote Added: 0033222
2013-06-04 08:08Brad KingStatusnew => resolved
2013-06-04 08:08Brad KingResolutionopen => won't fix
2013-11-04 09:33Robert MaynardNote Added: 0034360
2013-11-04 09:33Robert MaynardStatusresolved => closed

Notes
(0033222)
Brad King   
2013-06-04 08:08   
Two leading slashes is a valid *network* path prefix: //machine/share/... so they cannot be stripped.
(0034360)
Robert Maynard   
2013-11-04 09:33   
Closing resolved issues that have not been updated in more than 4 months.