MantisBT - CMake
View Issue Details
0013826CMakeCMakepublic2013-01-01 14:282013-06-03 09:05
ofir 
Brad King 
lowminoralways
closedfixed 
AnyLinux
CMake 2.8.10.1 
CMake 2.8.11CMake 2.8.11 
0013826: Problem with creating installation directories conatining a colon (:)
When running 'make install' with DESTDIR to a directory containing a colon, cmake won't create parent directories. If parent directories already exist everything works fine.
With any cmake project that has some install() command:

make install DESTDIR=aa/b:b
<error>
mkdir aa
make install DESTDIR=aa/b:b
<works>
The MakeDirectory function in Source/kwsys/SystemTools.cxx parses the directory tree after the first colon it finds, probably to eliminate drive name in Windows environment, although no #ifdef is in sight.

Also, it seems that this code just below

  if(dir[dir.size()-1] == '/')
    {
    topdir = dir.substr(0, dir.size());
    }
  else
    {
    topdir = dir;
    }

does nothing.
No tags attached.
Issue History
2013-01-01 14:28ofirNew Issue
2013-01-02 11:52Brad KingNote Added: 0031958
2013-01-07 09:57Brad KingNote Added: 0031992
2013-01-07 09:57Brad KingAssigned To => Brad King
2013-01-07 09:57Brad KingStatusnew => resolved
2013-01-07 09:57Brad KingResolutionopen => fixed
2013-01-07 09:57Brad KingFixed in Version => CMake 2.8.11
2013-01-07 09:57Brad KingTarget Version => CMake 2.8.11
2013-01-08 08:49Brad KingNote Added: 0032003
2013-06-03 09:05Robert MaynardNote Added: 0033182
2013-06-03 09:05Robert MaynardStatusresolved => closed

Notes
(0031958)
Brad King   
2013-01-02 11:52   
The SystemTools::MakeDirectory code was inherited long ago from another project and obviously wasn't reviewed in detail. The logic doesn't make sense. As you observe it looks like it's trying to handle Windows drive letters somehow but all it does is skip over slashes before the first ':'. Try this patch:

diff --git a/SystemTools.cxx b/SystemTools.cxx
index f915e56..9925640 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -622,11 +622,7 @@ bool SystemTools::MakeDirectory(const char* path)
     }
   SystemTools::ConvertToUnixSlashes(dir);
 
- kwsys_stl::string::size_type pos = dir.find(':');
- if(pos == kwsys_stl::string::npos)
- {
- pos = 0;
- }
+ kwsys_stl::string::size_type pos = 0;
   kwsys_stl::string topdir;
   while((pos = dir.find('/', pos)) != kwsys_stl::string::npos)
     {
@@ -634,14 +630,6 @@ bool SystemTools::MakeDirectory(const char* path)
     Mkdir(topdir.c_str());
     pos++;
     }
- if(dir[dir.size()-1] == '/')
- {
- topdir = dir.substr(0, dir.size());
- }
- else
- {
- topdir = dir;
- }
   if(Mkdir(topdir.c_str()) != 0)
     {
     // There is a bug in the Borland Run time library which makes MKDIR
--
1.7.10.4
(0031992)
Brad King   
2013-01-07 09:57   
Patch applied to KWSys upstream:

 http://public.kitware.com/gitweb?p=KWSys.git;a=commitdiff;h=cb5f835f [^]

and imported into CMake here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6969515b [^]
(0032003)
Brad King   
2013-01-08 08:49   
Dumb mistake in patch fixed here:

 http://public.kitware.com/gitweb?p=KWSys.git;a=commitdiff;h=34177aec [^]

and both patches re-imported into CMake here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=495fa24d [^]
(0033182)
Robert Maynard   
2013-06-03 09:05   
Closing resolved issues that have not been updated in more than 4 months.