Backed out changeset e5e2ac9bb33b (bug 1530240) for causing build bustages in updatedefines.h CLOSED TREE
authorNoemi Erli <nerli@mozilla.com>
Tue, 26 Feb 2019 03:18:09 +0200
changeset 518981 3cf44f4ad5ce21fecf0374bb99cc1c21787cd2cc
parent 518980 e5e2ac9bb33b81c020b6b7fcc20b706b3f9921f8
child 518982 f9578d20e54ec0c0ffebe29d78946352cc9ae438
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1530240
milestone67.0a1
backs oute5e2ac9bb33b81c020b6b7fcc20b706b3f9921f8
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset e5e2ac9bb33b (bug 1530240) for causing build bustages in updatedefines.h CLOSED TREE
toolkit/mozapps/update/common/updatedefines.h
toolkit/mozapps/update/tests/TestAUSHelper.cpp
toolkit/mozapps/update/tests/moz.build
--- a/toolkit/mozapps/update/common/updatedefines.h
+++ b/toolkit/mozapps/update/common/updatedefines.h
@@ -50,17 +50,28 @@
 #  define DELETE_DIR L"tobedeleted"
 #  define CALLBACK_BACKUP_EXT L".moz-callback"
 
 #  define LOG_S "%S"
 #  define NS_CONCAT(x, y) x##y
 // The extra layer of indirection here allows this macro to be passed macros
 #  define NS_T(str) NS_CONCAT(L, str)
 #  define NS_SLASH NS_T('\\')
-#  define NS_tvsnprintf _vsnwprintf
+
+static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt,
+                              ...) {
+  size_t _count = count - 1;
+  va_list varargs;
+  va_start(varargs, fmt);
+  int result = _vsnwprintf(dest, count - 1, fmt, varargs);
+  va_end(varargs);
+  dest[_count] = L'\0';
+  return result;
+}
+#  define NS_tsnprintf mywcsprintf
 #  define NS_taccess _waccess
 #  define NS_tatoi _wtoi64
 #  define NS_tchdir _wchdir
 #  define NS_tchmod _wchmod
 #  define NS_tfopen _wfopen
 #  define NS_tmkdir(path, perms) _wmkdir(path)
 #  define NS_tpid __int64
 #  define NS_tremove _wremove
@@ -98,17 +109,17 @@
 
 #  ifdef XP_MACOSX
 #    include <sys/time.h>
 #  endif
 
 #  define LOG_S "%s"
 #  define NS_T(str) str
 #  define NS_SLASH NS_T('/')
-#  define NS_tvsnprintf vsnprintf
+#  define NS_tsnprintf snprintf
 #  define NS_taccess access
 #  define NS_tatoi atoi
 #  define NS_tchdir chdir
 #  define NS_tchmod chmod
 #  define NS_tfopen fopen
 #  define NS_tmkdir mkdir
 #  define NS_tpid int
 #  define NS_tremove remove
@@ -129,19 +140,9 @@
 #  define NS_tdirent dirent
 #  define NS_topendir opendir
 #  define NS_tclosedir closedir
 #  define NS_treaddir readdir
 #endif
 
 #define BACKUP_EXT NS_T(".moz-backup")
 
-static inline bool NS_tsnprintf(NS_tchar* dest, size_t count,
-                                const NS_tchar* fmt, ...) {
-  va_list varargs;
-  va_start(varargs, fmt);
-  int result = NS_tvsnprintf(dest, count - 1, fmt, varargs);
-  va_end(varargs);
-  dest[count - 1] = NS_T('\0');
-  return result >= 0 && (size_t)result < count;
-}
-
 #endif
--- a/toolkit/mozapps/update/tests/TestAUSHelper.cpp
+++ b/toolkit/mozapps/update/tests/TestAUSHelper.cpp
@@ -140,56 +140,45 @@ int NS_main(int argc, NS_tchar **argv) {
     if (!NS_tstrcmp(argv[1], NS_T("post-update-async")) ||
         !NS_tstrcmp(argv[1], NS_T("post-update-sync"))) {
       NS_tchar exePath[MAXPATHLEN];
 #ifdef XP_WIN
       if (!::GetModuleFileNameW(0, exePath, MAXPATHLEN)) {
         return 1;
       }
 #else
-      if (!NS_tsnprintf(exePath, sizeof(exePath) / sizeof(exePath[0]),
-                        NS_T("%s"), argv[0])) {
-        return 1;
-      }
+      strcpy(exePath, argv[0]);
 #endif
       NS_tchar runFilePath[MAXPATHLEN];
-      if (!NS_tsnprintf(runFilePath,
-                        sizeof(runFilePath) / sizeof(runFilePath[0]),
-                        NS_T("%s.running"), exePath)) {
-        return 1;
-      }
+      NS_tsnprintf(runFilePath, sizeof(runFilePath) / sizeof(runFilePath[0]),
+                   NS_T("%s.running"), exePath);
 #ifdef XP_WIN
       if (!NS_taccess(runFilePath, F_OK)) {
         // This makes it possible to check if the post update process was
         // launched twice which happens when the service performs an update.
         NS_tchar runFilePathBak[MAXPATHLEN];
-        if (!NS_tsnprintf(runFilePathBak,
-                          sizeof(runFilePathBak) / sizeof(runFilePathBak[0]),
-                          NS_T("%s.bak"), runFilePath)) {
-          return 1;
-        }
+        NS_tsnprintf(runFilePathBak,
+                     sizeof(runFilePathBak) / sizeof(runFilePathBak[0]),
+                     NS_T("%s.bak"), runFilePath);
         MoveFileExW(runFilePath, runFilePathBak, MOVEFILE_REPLACE_EXISTING);
       }
 #endif
       WriteMsg(runFilePath, "running");
 
       if (!NS_tstrcmp(argv[1], NS_T("post-update-sync"))) {
 #ifdef XP_WIN
         Sleep(2000);
 #else
         sleep(2);
 #endif
       }
 
       NS_tchar logFilePath[MAXPATHLEN];
-      if (!NS_tsnprintf(logFilePath,
-                        sizeof(logFilePath) / sizeof(logFilePath[0]),
-                        NS_T("%s.log"), exePath)) {
-        return 1;
-      }
+      NS_tsnprintf(logFilePath, sizeof(logFilePath) / sizeof(logFilePath[0]),
+                   NS_T("%s.log"), exePath);
       WriteMsg(logFilePath, "post-update");
       return 0;
     }
   }
 
   if (argc < 3) {
     fprintf(
         stderr,
@@ -242,94 +231,70 @@ int NS_main(int argc, NS_tchar **argv) {
     // Not implemented on non-Windows platforms
     return 1;
 #endif
   }
 
   if (!NS_tstrcmp(argv[1], NS_T("setup-symlink"))) {
 #ifdef XP_UNIX
     NS_tchar path[MAXPATHLEN];
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
-                      NS_T("/tmp"), argv[2])) {
-      return 1;
-    }
-    if (mkdir(path, 0755)) {
-      return 1;
-    }
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s"),
-                      NS_T("/tmp"), argv[2], argv[3])) {
-      return 1;
-    }
-    if (mkdir(path, 0755)) {
-      return 1;
-    }
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s/%s"),
-                      NS_T("/tmp"), argv[2], argv[3], argv[4])) {
-      return 1;
-    }
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
+                 NS_T("/tmp"), argv[2]);
+    mkdir(path, 0755);
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s"),
+                 NS_T("/tmp"), argv[2], argv[3]);
+    mkdir(path, 0755);
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s/%s"),
+                 NS_T("/tmp"), argv[2], argv[3], argv[4]);
     FILE *file = NS_tfopen(path, NS_T("w"));
     if (file) {
       NS_tfputs(NS_T("test"), file);
       fclose(file);
     }
     if (symlink(path, argv[5]) != 0) {
       return 1;
     }
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
-                      NS_T("/tmp"), argv[2])) {
-      return 1;
-    }
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
+                 NS_T("/tmp"), argv[2]);
     if (argc > 6 && !NS_tstrcmp(argv[6], NS_T("change-perm"))) {
-      if (chmod(path, 0644)) {
-        return 1;
-      }
+      chmod(path, 0644);
     }
     return 0;
 #else
     // Not implemented on non-Unix platforms
     return 1;
 #endif
   }
 
   if (!NS_tstrcmp(argv[1], NS_T("remove-symlink"))) {
 #ifdef XP_UNIX
     NS_tchar path[MAXPATHLEN];
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
-                      NS_T("/tmp"), argv[2])) {
-      return 1;
-    }
-    (void)chmod(path, 0755);
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s/%s"),
-                      NS_T("/tmp"), argv[2], argv[3], argv[4])) {
-      return 1;
-    }
-    (void)unlink(path);
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s"),
-                      NS_T("/tmp"), argv[2], argv[3])) {
-      return 1;
-    }
-    (void)rmdir(path);
-    if (!NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
-                      NS_T("/tmp"), argv[2])) {
-      return 1;
-    }
-    (void)rmdir(path);
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
+                 NS_T("/tmp"), argv[2]);
+    chmod(path, 0755);
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s/%s"),
+                 NS_T("/tmp"), argv[2], argv[3], argv[4]);
+    unlink(path);
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s/%s"),
+                 NS_T("/tmp"), argv[2], argv[3]);
+    rmdir(path);
+    NS_tsnprintf(path, sizeof(path) / sizeof(path[0]), NS_T("%s/%s"),
+                 NS_T("/tmp"), argv[2]);
+    rmdir(path);
     return 0;
 #else
     // Not implemented on non-Unix platforms
     return 1;
 #endif
   }
 
   if (!NS_tstrcmp(argv[1], NS_T("check-symlink"))) {
 #ifdef XP_UNIX
     struct stat ss;
-    if (lstat(argv[2], &ss)) {
-      return 1;
-    }
+    lstat(argv[2], &ss);
     return S_ISLNK(ss.st_mode) ? 0 : 1;
 #else
     // Not implemented on non-Unix platforms
     return 1;
 #endif
   }
 
   if (!NS_tstrcmp(argv[1], NS_T("wait-for-service-stop"))) {
@@ -414,25 +379,21 @@ int NS_main(int argc, NS_tchar **argv) {
   }
 
   // File in use test helper section
   if (!NS_tstrcmp(argv[4], NS_T("-s"))) {
     // Note: glibc's getcwd() allocates the buffer dynamically using malloc(3)
     // if buf (the 1st param) is NULL so free cwd when it is no longer needed.
     NS_tchar *cwd = NS_tgetcwd(nullptr, 0);
     NS_tchar inFilePath[MAXPATHLEN];
-    if (!NS_tsnprintf(inFilePath, sizeof(inFilePath) / sizeof(inFilePath[0]),
-                      NS_T("%s/%s"), cwd, argv[2])) {
-      return 1;
-    }
+    NS_tsnprintf(inFilePath, sizeof(inFilePath) / sizeof(inFilePath[0]),
+                 NS_T("%s/%s"), cwd, argv[2]);
     NS_tchar outFilePath[MAXPATHLEN];
-    if (!NS_tsnprintf(outFilePath, sizeof(outFilePath) / sizeof(outFilePath[0]),
-                      NS_T("%s/%s"), cwd, argv[3])) {
-      return 1;
-    }
+    NS_tsnprintf(outFilePath, sizeof(outFilePath) / sizeof(outFilePath[0]),
+                 NS_T("%s/%s"), cwd, argv[3]);
     free(cwd);
 
     int seconds = NS_ttoi(argv[5]);
 #ifdef XP_WIN
     HANDLE hFile = INVALID_HANDLE_VALUE;
     if (argc == 7) {
       hFile = CreateFileW(argv[6], DELETE | GENERIC_WRITE, 0, nullptr,
                           OPEN_EXISTING, 0, nullptr);
@@ -460,24 +421,20 @@ int NS_main(int argc, NS_tchar **argv) {
 #endif
     WriteMsg(outFilePath, "finished");
     return 0;
   }
 
   {
     // Command line argument test helper section
     NS_tchar logFilePath[MAXPATHLEN];
-    if (!NS_tsnprintf(logFilePath, sizeof(logFilePath) / sizeof(logFilePath[0]),
-                      NS_T("%s"), argv[2])) {
-      return 1;
-    }
+    NS_tsnprintf(logFilePath, sizeof(logFilePath) / sizeof(logFilePath[0]),
+                 NS_T("%s"), argv[2]);
+
     FILE *logFP = NS_tfopen(logFilePath, NS_T("wb"));
-    if (!logFP) {
-      return 1;
-    }
     for (int i = 1; i < argc; ++i) {
       fprintf(logFP, LOG_S "\n", argv[i]);
     }
 
     fclose(logFP);
     logFP = nullptr;
   }
 
--- a/toolkit/mozapps/update/tests/moz.build
+++ b/toolkit/mozapps/update/tests/moz.build
@@ -102,8 +102,12 @@ FINAL_TARGET_FILES += [
 ]
 
 FINAL_TARGET_PP_FILES += [
     'data/xpcshellConstantsPP.js',
 ]
 
 with Files("browser/browser_TelemetryUpdatePing.js"):
     BUG_COMPONENT = ("Toolkit", "Telemetry")
+
+if CONFIG['CC_TYPE'] == 'gcc':
+    CXXFLAGS += ['-Wno-format-truncation']
+