Mac v2 signing - Bug 1075169 - Copy staged update when renaming fails and fix crash on staging failure. r=spohl, a=RyanVM over irc
authorRobert Strong <robert.bugzilla@gmail.com>
Tue, 30 Sep 2014 20:36:45 -0700
changeset 208043 14665b1de5ee8926ec632f399e7f1c7dbc5ed3e8
parent 208042 6c824fbb73e87044e63f52917f4159ffa4500be8
child 208044 49d21726b9dd31baebc7f941f0083a65e56fdbd2
push id27573
push userrstrong@mozilla.com
push dateWed, 01 Oct 2014 03:37:40 +0000
treeherderautoland@14665b1de5ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl, RyanVM
bugs1075169
milestone35.0a1
first release with
nightly linux32
14665b1de5ee / 35.0a1 / 20141001030205 / files
nightly linux64
14665b1de5ee / 35.0a1 / 20141001030205 / files
nightly mac
14665b1de5ee / 35.0a1 / 20141001030205 / files
nightly win32
14665b1de5ee / 35.0a1 / 20141001030205 / files
nightly win64
14665b1de5ee / 35.0a1 / 20141001030205 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Mac v2 signing - Bug 1075169 - Copy staged update when renaming fails and fix crash on staging failure. r=spohl, a=RyanVM over irc
toolkit/mozapps/update/updater/updater.cpp
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -1986,16 +1986,24 @@ ProcessReplaceRequest()
   if (rv) {
     LOG(("Moving destDir to tmpDir failed, err: %d", rv));
     return rv;
   }
 
   LOG(("Begin moving newDir (" LOG_S ") to destDir (" LOG_S ")",
        newDir, destDir));
   rv = rename_file(newDir, destDir, true);
+#ifdef XP_MACOSX
+  if (rv) {
+    LOG(("Moving failed. Begin copying newDir (" LOG_S ") to destDir (" LOG_S ")",
+         newDir, destDir));
+    copy_recursive_skiplist<0> skiplist;
+    rv = ensure_copy_recursive(newDir, destDir, skiplist);
+  }
+#endif
   if (rv) {
     LOG(("Moving newDir to destDir failed, err: %d", rv));
     LOG(("Now, try to move tmpDir back to destDir"));
     ensure_remove_recursive(destDir);
     int rv2 = rename_file(tmpDir, destDir, true);
     if (rv2) {
       LOG(("Moving tmpDir back to destDir failed, err: %d", rv2));
     }
@@ -2172,18 +2180,17 @@ UpdateThreadFunc(void *param)
     // updater application again in order to apply the update without
     // staging.
     // The MOZ_NO_REPLACE_FALLBACK environment variable is used to
     // bypass this fallback, and is used in the updater tests.
     // The only special thing which we should do here is to remove the
     // staged directory as it won't be useful any more.
     ensure_remove_recursive(gWorkingDirPath);
     WriteStatusFile(sUsingService ? "pending-service" : "pending");
-    char processUpdates[] = "MOZ_PROCESS_UPDATES=";
-    putenv(processUpdates); // We need to use -process-updates again in the tests
+    putenv(const_cast<char*>("MOZ_PROCESS_UPDATES=")); // We need to use -process-updates again in the tests
     reportRealResults = false; // pretend success
   }
 
   if (reportRealResults) {
     if (rv) {
       LOG(("failed: %d", rv));
     }
     else {