Title: [257691] trunk/Source/ThirdParty
Revision
257691
Author
[email protected]
Date
2020-03-01 10:24:29 -0800 (Sun, 01 Mar 2020)

Log Message

Re-add the patch used to work around gtest linking failure on FreeBSD
https://bugs.webkit.org/show_bug.cgi?id=208409

Patch by Ting-Wei Lan <[email protected]> on 2020-03-01
Reviewed by Michael Catanzaro.

The patch was added in https://bugs.webkit.org/show_bug.cgi?id=138420 to
fix gtest linking error on FreeBSD. However, it was accidentally dropped
in r235613, the commit updating gtest, causing the error to happen
again. Re-add it to fix the build on FreeBSD.

* gtest/src/gtest-death-test.cc:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/ThirdParty/ChangeLog (257690 => 257691)


--- trunk/Source/ThirdParty/ChangeLog	2020-03-01 17:55:58 UTC (rev 257690)
+++ trunk/Source/ThirdParty/ChangeLog	2020-03-01 18:24:29 UTC (rev 257691)
@@ -1,3 +1,17 @@
+2020-03-01  Ting-Wei Lan  <[email protected]>
+
+        Re-add the patch used to work around gtest linking failure on FreeBSD
+        https://bugs.webkit.org/show_bug.cgi?id=208409
+
+        Reviewed by Michael Catanzaro.
+
+        The patch was added in https://bugs.webkit.org/show_bug.cgi?id=138420 to
+        fix gtest linking error on FreeBSD. However, it was accidentally dropped
+        in r235613, the commit updating gtest, causing the error to happen
+        again. Re-add it to fix the build on FreeBSD.
+
+        * gtest/src/gtest-death-test.cc:
+
 2020-01-24  Sergio Villar Senin  <[email protected]>
 
         Remove WebVR from the tree

Added: trunk/Source/ThirdParty/gtest/README.WebKit (0 => 257691)


--- trunk/Source/ThirdParty/gtest/README.WebKit	                        (rev 0)
+++ trunk/Source/ThirdParty/gtest/README.WebKit	2020-03-01 18:24:29 UTC (rev 257691)
@@ -0,0 +1,6 @@
+GTest v.1.8.1
+
+https://github.com/google/googletest/releases/tag/release-1.8.1/
+
+2016-01-02 Ting-Wei Lan ([email protected])
+      Remove usage of environ global variable to fix the build on FreeBSD.

Added: trunk/Source/ThirdParty/gtest/changes.diff (0 => 257691)


--- trunk/Source/ThirdParty/gtest/changes.diff	                        (rev 0)
+++ trunk/Source/ThirdParty/gtest/changes.diff	2020-03-01 18:24:29 UTC (rev 257691)
@@ -0,0 +1,39 @@
+diff --git a/Source/ThirdParty/gtest/src/gtest-death-test.cc b/Source/ThirdParty/gtest/src/gtest-death-test.cc
+index 09083551612..ac8660354ca 100644
+--- a/Source/ThirdParty/gtest/src/gtest-death-test.cc
++++ b/Source/ThirdParty/gtest/src/gtest-death-test.cc
+@@ -1152,20 +1152,6 @@ struct ExecDeathTestArgs {
+   int close_fd;       // File descriptor to close; the read end of a pipe
+ };
+ 
+-#  if GTEST_OS_MAC
+-inline char** GetEnviron() {
+-  // When Google Test is built as a framework on MacOS X, the environ variable
+-  // is unavailable. Apple's documentation (man environ) recommends using
+-  // _NSGetEnviron() instead.
+-  return *_NSGetEnviron();
+-}
+-#  else
+-// Some POSIX platforms expect you to declare environ. extern "C" makes
+-// it reside in the global namespace.
+-extern "C" char** environ;
+-inline char** GetEnviron() { return environ; }
+-#  endif  // GTEST_OS_MAC
+-
+ #  if !GTEST_OS_QNX
+ // The main function for a threadsafe-style death test child process.
+ // This function is called in a clone()-ed process and thus must avoid
+@@ -1191,8 +1177,11 @@ static int ExecDeathTestChildMain(void* child_arg) {
+   // unsafe.  Since execve() doesn't search the PATH, the user must
+   // invoke the test program via a valid path that contains at least
+   // one path separator.
+-  execve(args->argv[0], args->argv, GetEnviron());
+-  DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
++  // We have replaced execve() with execv() for WebKit to avoid using
++  // environ. It should be safe because execv() is just a simple wrapper
++  // of execve().
++  execv(args->argv[0], args->argv);
++  DeathTestAbort(std::string("execv(") + args->argv[0] + ", ...) in " +
+                  original_dir + " failed: " +
+                  GetLastErrnoDescription());
+   return EXIT_FAILURE;

Modified: trunk/Source/ThirdParty/gtest/src/gtest-death-test.cc (257690 => 257691)


--- trunk/Source/ThirdParty/gtest/src/gtest-death-test.cc	2020-03-01 17:55:58 UTC (rev 257690)
+++ trunk/Source/ThirdParty/gtest/src/gtest-death-test.cc	2020-03-01 18:24:29 UTC (rev 257691)
@@ -1152,20 +1152,6 @@
   int close_fd;       // File descriptor to close; the read end of a pipe
 };
 
-#  if GTEST_OS_MAC
-inline char** GetEnviron() {
-  // When Google Test is built as a framework on MacOS X, the environ variable
-  // is unavailable. Apple's documentation (man environ) recommends using
-  // _NSGetEnviron() instead.
-  return *_NSGetEnviron();
-}
-#  else
-// Some POSIX platforms expect you to declare environ. extern "C" makes
-// it reside in the global namespace.
-extern "C" char** environ;
-inline char** GetEnviron() { return environ; }
-#  endif  // GTEST_OS_MAC
-
 #  if !GTEST_OS_QNX
 // The main function for a threadsafe-style death test child process.
 // This function is called in a clone()-ed process and thus must avoid
@@ -1191,8 +1177,11 @@
   // unsafe.  Since execve() doesn't search the PATH, the user must
   // invoke the test program via a valid path that contains at least
   // one path separator.
-  execve(args->argv[0], args->argv, GetEnviron());
-  DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
+  // We have replaced execve() with execv() for WebKit to avoid using
+  // environ. It should be safe because execv() is just a simple wrapper
+  // of execve().
+  execv(args->argv[0], args->argv);
+  DeathTestAbort(std::string("execv(") + args->argv[0] + ", ...) in " +
                  original_dir + " failed: " +
                  GetLastErrnoDescription());
   return EXIT_FAILURE;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to