[cmake-commits] martink committed SystemTools.cxx 1.188 1.189
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Feb 1 14:11:08 EST 2007
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv3394/Source/kwsys
Modified Files:
SystemTools.cxx
Log Message:
BUG: fix for bug number 3320
Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- SystemTools.cxx 30 Jan 2007 16:32:33 -0000 1.188
+++ SystemTools.cxx 1 Feb 2007 19:11:06 -0000 1.189
@@ -2513,6 +2513,8 @@
if( SystemTools::FileIsDirectory( path_a.c_str() ) )
{
// Make sure the path is a full path and does not contain no '..'
+ // Ken--the following code is incorrect. .. can be in a valid path
+ // for example /home/martink/MyHubba...Hubba/Src
if( SystemTools::FileIsFullPath(path_b.c_str()) && path_b.find("..")
== kwsys_stl::string::npos )
{
@@ -2605,6 +2607,9 @@
// Split the input path components.
kwsys_stl::vector<kwsys_stl::string> path_components;
SystemTools::SplitPath(in_path, path_components);
+
+ // clean the input path to remove any /./
+
// If the input path is relative, start with a base path.
if(path_components[0].length() == 0)
{
@@ -2640,11 +2645,36 @@
path_components.begin(),
path_components.end());
+ // remove any . components as they do nothing
+ kwsys_stl::vector<kwsys_stl::string> clean_components;
+ kwsys_stl::vector<kwsys_stl::string>::iterator i =
+ out_components.begin();
+ for (; i != out_components.end(); ++i)
+ {
+ if (*i != ".")
+ {
+ clean_components.push_back(*i);
+ }
+ }
+
+
// Transform the path back to a string.
- kwsys_stl::string newPath = SystemTools::JoinPath(out_components);
+ kwsys_stl::string newPath = SystemTools::JoinPath(clean_components);
+
+ // Update the translation table with this potentially new path. I am not
+ // sure why this line is here, it seems really questionable, but yet I
+ // would put good money that if I remove it something will break, basically
+ // from what I can see it created a mapping from the collapsed path, to be
+ // replaced by the input path, which almost completely does the opposite of
+ // this function, the only thing preventing this from happening a lot is
+ // that if the in_path has a .. in it, then it is not added to the
+ // translation table. So for most calls this either does nothing due to the
+ // .. or it adds a translation between identical paths as nothing was
+ // collapsed, so I am going to try to comment it out, and see what hits the
+ // fan, hopefully quickly.
+ // Commented out line below:
+ //SystemTools::AddTranslationPath(newPath.c_str(), in_path);
- // Update the translation table with this potentially new path.
- SystemTools::AddTranslationPath(newPath.c_str(), in_path);
SystemTools::CheckTranslationPath(newPath);
#ifdef _WIN32
newPath = SystemTools::GetActualCaseForPath(newPath.c_str());
More information about the Cmake-commits
mailing list