This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  3bb2ea08cfe1d3cf44dd8e445b91fef67ad39b52 (commit)
       via  43a5478d2529918c4defd2bcf20eea2c9fb86dd6 (commit)
       via  da6109df0f20dd871ddf43911c8313f57d77806c (commit)
      from  3cc10db00337a29985166b6fe2b95b9c38d49241 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3bb2ea08cfe1d3cf44dd8e445b91fef67ad39b52
commit 3bb2ea08cfe1d3cf44dd8e445b91fef67ad39b52
Merge: 3cc10db 43a5478
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Feb 12 10:58:41 2013 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Tue Feb 12 10:58:41 2013 -0500

    Merge topic 'vs-atomic-generated-stamp' into next
    
    43a5478 VS: Replace generation timestamp file atomically
    da6109d CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43a5478d2529918c4defd2bcf20eea2c9fb86dd6
commit 43a5478d2529918c4defd2bcf20eea2c9fb86dd6
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Feb 12 10:46:22 2013 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Feb 12 10:51:37 2013 -0500

    VS: Replace generation timestamp file atomically
    
    Since commit 34c882a9 (Allow VS 7 project Rebuild and Solution Rebuild to
    work, 2007-11-10) we use a "CMakeFiles/generated.stamp" and some
    associated files in the build tree to avoid re-running CMake when the
    inputs have not changed but VS has cleaned the outputs it knows about.
    
    When we do not really need to re-run we restore the generated.stamp file.
    The non-re-run case can happen in multiple targets in parallel in VS >= 10
    so we must restore the file atomically to avoid races.  Write the stamp
    file to a random temporary name and then atomically rename it to the real
    stamp file.

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index d57e981..f65fc22 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -4033,10 +4033,17 @@ static bool cmakeCheckStampFile(const char* stampName)
     }
 
   // The build system is up to date.  The stamp file has been removed
-  // by the VS IDE due to a "rebuild" request.  Just restore it.
-  std::ofstream stamp(stampName);
+  // by the VS IDE due to a "rebuild" request.  Restore it atomically.
+  cmOStringStream stampTempStr;
+  stampTempStr << stampName << ".tmp" << cmSystemTools::RandomSeed();
+  const char* stampTemp = stampTempStr.str().c_str();
+  {
+  // TODO: Teach cmGeneratedFileStream to use a random temp file (with
+  // multiple tries in unlikely case of conflict) and use that here.
+  std::ofstream stamp(stampTemp);
   stamp << "# CMake generation timestamp file this directory.\n";
-  if(stamp)
+  }
+  if(cmSystemTools::RenameFile(stampTemp, stampName))
     {
     // Notify the user why CMake is not re-running.  It is safe to
     // just print to stdout here because this code is only reachable
@@ -4047,6 +4054,7 @@ static bool cmakeCheckStampFile(const char* stampName)
     }
   else
     {
+    cmSystemTools::RemoveFile(stampTemp);
     cmSystemTools::Error("Cannot restore timestamp ", stampName);
     return false;
     }

-----------------------------------------------------------------------

Summary of changes:
 Source/CMakeVersion.cmake |    2 +-
 Source/cmake.cxx          |   14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to