25064722 pidgin: remove SIGCHLD signal handler
authorRich Burridge <rich.burridge@oracle.com>
Wed, 09 Nov 2016 09:08:47 -0800
changeset 7277 a51b37054c45
parent 7276 eae106639cae
child 7278 89aa34de7ca6
25064722 pidgin: remove SIGCHLD signal handler
components/desktop/pidgin/patches/pidgin-20-fix-sigalrm.patch
components/desktop/pidgin/patches/pidgin-22-remove-sigchld-handler.patch
--- a/components/desktop/pidgin/patches/pidgin-20-fix-sigalrm.patch	Wed Nov 09 09:06:55 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-The sighandler() function in pidgin/gtkmain.c doesn't restore a SIGALRM
-handler.
-
-See: https://developer.pidgin.im/ticket/7902
-
-This was closed as fixed, but that doesn't seem to be the case.
-
---- pidgin-2.11.0/pidgin/gtkmain.c.orig	2016-08-25 15:00:41.875707111 +0000
-+++ pidgin-2.11.0/pidgin/gtkmain.c	2016-08-25 15:02:50.909744713 +0000
[email protected]@ -229,13 +229,17 @@
- 		alarm(1);
- 		break;
- 	case SIGALRM:
-+		clean_pid();
-+		/* Restore signal catching */
-+		signal(SIGALRM, sighandler);
-+		break;
- #else
- 	case SIGCHLD:
--#endif
- 		clean_pid();
- 		/* Restore signal catching */
- 		signal(SIGCHLD, sighandler);
- 		break;
-+#endif
- 	default:
- 		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
- 		purple_core_quit();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/desktop/pidgin/patches/pidgin-22-remove-sigchld-handler.patch	Wed Nov 09 09:08:47 2016 -0800
@@ -0,0 +1,105 @@
+Remove SIGCHLD signal handler.
+
+DNS processes are already reaped in libpurple. Sound processes are
+reaped after 15 seconds. Other processes are sent through GLib and
+reaped by it. Anyway, this means we can stop preventing GStreamer
+from forking, and maybe fix a D-Bus bug, or something.
+
+Fixes #5553 - https://developer.pidgin.im/ticket/5553
+Fixes #7902 - https://developer.pidgin.im/ticket/7902
+
+(This patch is also included with the Debian version of pidgin.)
+
+--- pidgin-2.11.0/pidgin/gtkmain.c.orig	2016-11-08 10:49:01.655270291 +0000
++++ pidgin-2.11.0/pidgin/gtkmain.c	2016-11-08 10:52:39.758701309 +0000
[email protected]@ -88,10 +88,6 @@
+ 	SIGINT,
+ 	SIGTERM,
+ 	SIGQUIT,
+-	SIGCHLD,
+-#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
+-	SIGALRM,
+-#endif
+ 	-1
+ };
+ 
[email protected]@ -134,31 +130,6 @@
+ 
+ static int signal_sockets[2];
+ 
+-static void sighandler(int sig);
+-
+-/*
+- * This child process reaping stuff is currently only used for processes that
+- * were forked to play sounds.  It's not needed for forked DNS child, which
+- * have their own waitpid() call.  It might be wise to move this code into
+- * gtksound.c.
+- */
+-static void
+-clean_pid(void)
+-{
+-	int status;
+-	pid_t pid;
+-
+-	do {
+-		pid = waitpid(-1, &status, WNOHANG);
+-	} while (pid != 0 && pid != (pid_t)-1);
+-
+-	if ((pid == (pid_t) - 1) && (errno != ECHILD)) {
+-		char errmsg[BUFSIZ];
+-		snprintf(errmsg, sizeof(errmsg), "Warning: waitpid() returned %d", pid);
+-		perror(errmsg);
+-	}
+-}
+-
+ static void sighandler(int sig)
+ {
+ 	ssize_t written;
[email protected]@ -209,33 +180,8 @@
+ 		return FALSE;
+ 	}
+ 
+-	switch (sig) {
+-#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
+-/* By default, gstreamer forks when you initialize it, and waitpids for the
+- * child.  But if libpurple reaps the child rather than leaving it to
+- * gstreamer, gstreamer's initialization fails.  So, we wait a second before
+- * reaping child processes, to give gst a chance to reap it if it wants to.
+- *
+- * This is not needed in later gstreamers, which let us disable the forking.
+- * And, it breaks the world on some Real Unices.
+- */
+-	case SIGCHLD:
+-		/* Restore signal catching */
+-		signal(SIGCHLD, sighandler);
+-		alarm(1);
+-		break;
+-	case SIGALRM:
+-#else
+-	case SIGCHLD:
+-#endif
+-		clean_pid();
+-		/* Restore signal catching */
+-		signal(SIGCHLD, sighandler);
+-		break;
+-	default:
+-		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
+-		purple_core_quit();
+-	}
++	purple_debug_warning("sighandler", "Caught signal %d\n", sig);
++	purple_core_quit();
+ 
+ 	return TRUE;
+ }
+--- pidgin-2.11.0/pidgin/gtksound.c.orig	2016-11-08 10:49:08.984964482 +0000
++++ pidgin-2.11.0/pidgin/gtksound.c	2016-11-08 10:49:36.381141461 +0000
[email protected]@ -319,9 +319,6 @@
+ 
+ #ifdef USE_GSTREAMER
+ 	purple_debug_info("sound", "Initializing sound output drivers.\n");
+-#ifdef GST_CAN_DISABLE_FORKING
+-	gst_registry_fork_set_enabled (FALSE);
+-#endif
+ 	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
+ 		purple_notify_error(NULL, _("GStreamer Failure"),
+ 					_("GStreamer failed to initialize."),