[Cmake-commits] [cmake-commits] king committed cmake.cxx 1.406 1.407

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 2 16:02:21 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv26483/Source

Modified Files:
	cmake.cxx 
Log Message:
BUG: Gracefully handle broken version symlinks

This teaches the helper commands 'cmake -E cmake_symlink_executable' and
'cmake -E cmake_symlink_library' to remove broken symlinks before
creating a symlink and report an error when the symlink cannot be
created.  See issue #8654.


Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.406
retrieving revision 1.407
diff -C 2 -d -r1.406 -r1.407
*** cmake.cxx	10 Feb 2009 13:51:15 -0000	1.406
--- cmake.cxx	2 Mar 2009 21:02:19 -0000	1.407
***************
*** 1367,1371 ****
          {
          std::string fname = cmSystemTools::GetFilenameName(realName);
!         if(cmSystemTools::FileExists(soName.c_str()))
            {
            cmSystemTools::RemoveFile(soName.c_str());
--- 1367,1372 ----
          {
          std::string fname = cmSystemTools::GetFilenameName(realName);
!         if(cmSystemTools::FileExists(soName.c_str()) ||
!            cmSystemTools::FileIsSymlink(soName.c_str()))
            {
            cmSystemTools::RemoveFile(soName.c_str());
***************
*** 1373,1376 ****
--- 1374,1378 ----
          if(!cmSystemTools::CreateSymlink(fname.c_str(), soName.c_str()))
            {
+           cmSystemTools::ReportLastSystemError("cmake_symlink_library");
            result = 1;
            }
***************
*** 1379,1383 ****
          {
          std::string fname = cmSystemTools::GetFilenameName(soName);
!         if(cmSystemTools::FileExists(soName.c_str()))
            {
            cmSystemTools::RemoveFile(name.c_str());
--- 1381,1386 ----
          {
          std::string fname = cmSystemTools::GetFilenameName(soName);
!         if(cmSystemTools::FileExists(name.c_str()) ||
!            cmSystemTools::FileIsSymlink(name.c_str()))
            {
            cmSystemTools::RemoveFile(name.c_str());
***************
*** 1385,1388 ****
--- 1388,1392 ----
          if(!cmSystemTools::CreateSymlink(fname.c_str(), name.c_str()))
            {
+           cmSystemTools::ReportLastSystemError("cmake_symlink_library");
            result = 1;
            }
***************
*** 1399,1403 ****
          {
          std::string fname = cmSystemTools::GetFilenameName(realName);
!         if(cmSystemTools::FileExists(realName.c_str()))
            {
            cmSystemTools::RemoveFile(name.c_str());
--- 1403,1408 ----
          {
          std::string fname = cmSystemTools::GetFilenameName(realName);
!         if(cmSystemTools::FileExists(name.c_str()) ||
!            cmSystemTools::FileIsSymlink(name.c_str()))
            {
            cmSystemTools::RemoveFile(name.c_str());
***************
*** 1405,1408 ****
--- 1410,1414 ----
          if(!cmSystemTools::CreateSymlink(fname.c_str(), name.c_str()))
            {
+           cmSystemTools::ReportLastSystemError("cmake_symlink_executable");
            result = 1;
            }



More information about the Cmake-commits mailing list