pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/firefox Let application restart work on MacOS X < ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/68a708467f2e
branches:  trunk
changeset: 635434:68a708467f2e
user:      pho <pho%pkgsrc.org@localhost>
date:      Fri Jun 06 01:05:50 2014 +0000

description:
Let application restart work on MacOS X < 10.6

MacOS X < 10.6 had an undocumented behavior concerning execve(2)
inside a threaded process. If a process tried to call execve(2) and
had more than one active thread, the kernel returned ENOTSUP. So we
have to either fork(2) or vfork(2) before calling execve(2) to make
sure the caller is single-threaded as otherwise the application fails
to restart itself.

diffstat:

 www/firefox/distinfo                                  |   3 +-
 www/firefox/patches/patch-toolkit_xre_nsAppRunner.cpp |  36 +++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletions(-)

diffs (57 lines):

diff -r 3aafb297271d -r 68a708467f2e www/firefox/distinfo
--- a/www/firefox/distinfo      Thu Jun 05 23:41:26 2014 +0000
+++ b/www/firefox/distinfo      Fri Jun 06 01:05:50 2014 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.152 2014/05/30 10:22:05 pho Exp $
+$NetBSD: distinfo,v 1.153 2014/06/06 01:05:50 pho Exp $
 
 SHA1 (firefox-29.0.1.source.tar.bz2) = 2819ef63403de2bcfff5496bd21a3b8cb5dfce82
 RMD160 (firefox-29.0.1.source.tar.bz2) = f728179a12a46824971ca01cf79eb0318e4775c5
@@ -125,6 +125,7 @@
 SHA1 (patch-toolkit_components_osfile_modules_osfile__unix__back.jsm) = 274b06bd4bfea5b6d7d67c0d39a484d179ed560c
 SHA1 (patch-toolkit_library_Makefile.in) = fbbd166267a23d840babb0896c24a57e62708c7f
 SHA1 (patch-toolkit_toolkit.mozbuild) = 0993d50cc02c2b421e6de087dfb0a9cb30562c6b
+SHA1 (patch-toolkit_xre_nsAppRunner.cpp) = 20fffba2ca4067cdcdd81df2ea5fa3a92945c4bc
 SHA1 (patch-toolkit_xre_nsEmbedFunctions.cpp) = 6ee6fba04a3ecc6596f8aed67f752a1075901fa8
 SHA1 (patch-webapprt_moz.build) = cb3d92bc8ada1e2b49877cf7bbe6fbc32278230a
 SHA1 (patch-xb) = 30eea880b40cee45d1235d3292fead4b5a54bbaa
diff -r 3aafb297271d -r 68a708467f2e www/firefox/patches/patch-toolkit_xre_nsAppRunner.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/firefox/patches/patch-toolkit_xre_nsAppRunner.cpp     Fri Jun 06 01:05:50 2014 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-toolkit_xre_nsAppRunner.cpp,v 1.3 2014/06/06 01:05:50 pho Exp $
+
+MacOS X < 10.6 had an undocumented behavior concerning execve(2)
+inside a threaded process. If a process tried to call execve(2) and
+had more than one active thread, the kernel returned ENOTSUP. So we
+have to either fork(2) or vfork(2) before calling execve(2) to make
+sure the caller is single-threaded as otherwise the application fails
+to restart itself.
+
+__mac_execve() in XNU 1228 (Darwin 9, MacOS X 10.5) had the
+restriction:
+http://www.opensource.apple.com/source/xnu/xnu-1228.15.4/bsd/kern/kern_exec.c
+
+In XNU 1456 (Darwin 10, MacOS X 10.6) the multi-threaded check
+disappeared:
+http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/kern/kern_exec.c
+
+--- toolkit/xre/nsAppRunner.cpp.orig   2014-05-06 22:56:36.000000000 +0000
++++ toolkit/xre/nsAppRunner.cpp
+@@ -1715,6 +1715,16 @@ static nsresult LaunchChild(nsINativeApp
+ #elif defined(XP_OS2)
+   if (_execv(exePath.get(), gRestartArgv) == -1)
+     return NS_ERROR_FAILURE;
++#elif defined(XP_DARWIN)
++  pid_t pid = fork();
++  if (pid == 0) { // child
++      if (execv(exePath.get(), gRestartArgv) == -1) {
++          _exit(1);
++      }
++  }
++  else if (pid == -1) {
++      return NS_ERROR_FAILURE;
++  }
+ #elif defined(XP_UNIX)
+   if (execv(exePath.get(), gRestartArgv) == -1)
+     return NS_ERROR_FAILURE;



Home | Main Index | Thread Index | Old Index