all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Jorgen Schaefer <forcer@forcix.cx>
Cc: 17561@debbugs.gnu.org
Subject: bug#17561: Emacs can forget processes
Date: Wed, 28 May 2014 21:17:40 -0700	[thread overview]
Message-ID: <5386B4E4.4070100@cs.ucla.edu> (raw)
In-Reply-To: <20140529013505.65346321@forcix.jorgenschaefer.de>

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]

Can you please apply the attached patch to the emacs-24 branch, run 
./autogen.sh && configure && make clean && make, and then try it out on 
your platform?  Thanks.

[-- Attachment #2: sigmask.patch --]
[-- Type: text/plain, Size: 8884 bytes --]

=== modified file 'ChangeLog'
--- ChangeLog	2014-05-22 05:00:39 +0000
+++ ChangeLog	2014-05-29 04:12:16 +0000
@@ -1,3 +1,13 @@
+2014-05-29  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Don't substitute sigprocmask for pthread_sigmask (Bug#17561).
+	This helps to fix a bug which caused Emacs to lose CHLD signals
+	and thus appear to forget processes.
+	* configure.ac (gl_THREADLIB): Remove dummy.
+	Merge from gnulib, incorporating:
+	2014-05-28 pthread_sigmask, timer-time: use gl_THREADLIB only if needed
+	* m4/pthread_sigmask.m4, m4/timer_time.m4: Update from gnulib.
+
 2014-05-22  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Fix port to 32-bit AIX (Bug#17540).

=== modified file 'configure.ac'
--- configure.ac	2014-05-22 05:00:39 +0000
+++ configure.ac	2014-05-29 04:12:16 +0000
@@ -686,8 +686,6 @@
 # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
 # as we don't use them.
 AC_DEFUN([gl_FCNTL_O_FLAGS])
-# Avoid gnulib's threadlib module, as we do threads our own way.
-AC_DEFUN([gl_THREADLIB])
 
 # Initialize gnulib right after choosing the compiler.
 dnl Amongst other things, this sets AR and ARFLAGS.

=== modified file 'm4/pthread_sigmask.m4'
--- m4/pthread_sigmask.m4	2014-01-01 07:43:34 +0000
+++ m4/pthread_sigmask.m4	2014-05-29 04:12:16 +0000
@@ -1,4 +1,4 @@
-# pthread_sigmask.m4 serial 13
+# pthread_sigmask.m4 serial 14
 dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -97,39 +97,43 @@
     dnl with -lpthread, the pthread_sigmask() function always returns 0 and has
     dnl no effect.
     if test -z "$LIB_PTHREAD_SIGMASK"; then
-      AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread],
-        [gl_cv_func_pthread_sigmask_in_libc_works],
-        [
-          AC_RUN_IFELSE(
-            [AC_LANG_SOURCE([[
-#include <pthread.h>
-#include <signal.h>
-#include <stddef.h>
-int main ()
-{
-  sigset_t set;
-  sigemptyset (&set);
-  return pthread_sigmask (1729, &set, NULL) != 0;
-}]])],
-            [gl_cv_func_pthread_sigmask_in_libc_works=no],
-            [gl_cv_func_pthread_sigmask_in_libc_works=yes],
-            [
-changequote(,)dnl
-             case "$host_os" in
-               freebsd* | hpux* | solaris | solaris2.[2-9]*)
-                 gl_cv_func_pthread_sigmask_in_libc_works="guessing no";;
-               *)
-                 gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";;
-             esac
-changequote([,])dnl
-            ])
-        ])
-      case "$gl_cv_func_pthread_sigmask_in_libc_works" in
-        *no)
-          REPLACE_PTHREAD_SIGMASK=1
-          AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1],
-            [Define to 1 if pthread_sigmask() may returns 0 and have no effect.])
-          ;;
+      case " $LIBS " in
+        *' -lpthread '*) ;;
+	*)
+	  AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread],
+	    [gl_cv_func_pthread_sigmask_in_libc_works],
+	    [
+	      AC_RUN_IFELSE(
+		[AC_LANG_SOURCE([[
+		   #include <pthread.h>
+		   #include <signal.h>
+		   #include <stddef.h>
+		   int main ()
+		   {
+		     sigset_t set;
+		     sigemptyset (&set);
+		     return pthread_sigmask (1729, &set, NULL) != 0;
+		   }]])],
+		[gl_cv_func_pthread_sigmask_in_libc_works=no],
+		[gl_cv_func_pthread_sigmask_in_libc_works=yes],
+		[
+		 changequote(,)dnl
+		 case "$host_os" in
+		   freebsd* | hpux* | solaris | solaris2.[2-9]*)
+		     gl_cv_func_pthread_sigmask_in_libc_works="guessing no";;
+		   *)
+		     gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";;
+		 esac
+		 changequote([,])dnl
+		])
+	    ])
+	  case "$gl_cv_func_pthread_sigmask_in_libc_works" in
+	    *no)
+	      REPLACE_PTHREAD_SIGMASK=1
+	      AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1],
+		[Define to 1 if pthread_sigmask may return 0 and have no effect.])
+	      ;;
+	  esac;;
       esac
     fi
 
@@ -184,11 +188,12 @@
           *)
             gl_cv_func_pthread_sigmask_unblock_works="guessing yes";;
         esac
-        dnl Here we link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK,
-        dnl otherwise we get a false positive on those platforms where
-        dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no".
-        gl_save_LIBS="$LIBS"
-        LIBS="$LIBS $LIBMULTITHREAD"
+        m4_ifdef([gl_][THREADLIB],
+          [dnl Link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK.
+           dnl Otherwise we get a false positive on those platforms where
+           dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no".
+           gl_save_LIBS=$LIBS
+           LIBS="$LIBS $LIBMULTITHREAD"])
         AC_RUN_IFELSE(
           [AC_LANG_SOURCE([[
 #include <pthread.h>
@@ -227,7 +232,7 @@
           [:],
           [gl_cv_func_pthread_sigmask_unblock_works=no],
           [:])
-        LIBS="$gl_save_LIBS"
+        m4_ifdef([gl_][THREADLIB], [LIBS=$gl_save_LIBS])
       ])
     case "$gl_cv_func_pthread_sigmask_unblock_works" in
       *no)

=== modified file 'm4/timer_time.m4'
--- m4/timer_time.m4	2014-02-24 07:12:42 +0000
+++ m4/timer_time.m4	2014-05-29 04:12:16 +0000
@@ -1,4 +1,4 @@
-# timer_time.m4 serial 2
+# timer_time.m4 serial 3
 dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,7 +11,12 @@
   dnl Based on clock_time.m4. See details there.
 
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_REQUIRE([gl_THREADLIB])
+
+  dnl Test whether the gnulib module 'threadlib' is in use.
+  dnl Some packages like Emacs use --avoid=threadlib.
+  dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
+  dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
+  m4_ifdef([gl_][THREADLIB], [AC_REQUIRE([gl_][THREADLIB])])
 
   LIB_TIMER_TIME=
   AC_SUBST([LIB_TIMER_TIME])
@@ -19,21 +24,21 @@
     AC_SEARCH_LIBS([timer_settime], [rt posix4],
                    [test "$ac_cv_search_timer_settime" = "none required" ||
                     LIB_TIMER_TIME=$ac_cv_search_timer_settime])
-    dnl GLIBC uses threads to emulate posix timers when kernel support
-    dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
-    dnl Now the pthread lib is linked automatically in the normal case,
-    dnl but when linking statically, it needs to be explicitly specified.
-    AC_EGREP_CPP([Thread],
-      [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
-     && !(__UCLIBC__ && __HAS_NO_THREADS__)
-  Thread emulation available
- #endif
-#endif
-      ],
-      [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])
+    m4_ifdef([gl_][THREADLIB],
+      [dnl GLIBC uses threads to emulate posix timers when kernel support
+       dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
+       dnl Now the pthread lib is linked automatically in the normal case,
+       dnl but when linking statically, it needs to be explicitly specified.
+       AC_EGREP_CPP([Thread],
+         [#include <features.h>
+          #ifdef __GNU_LIBRARY__
+           #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
+               && !(__UCLIBC__ && __HAS_NO_THREADS__)
+            Thread emulation available
+           #endif
+          #endif
+         ],
+         [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])])
     AC_CHECK_FUNCS([timer_settime])
   LIBS=$gl_saved_libs
 ])

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2014-05-26 15:48:28 +0000
+++ src/ChangeLog	2014-05-29 04:12:16 +0000
@@ -1,3 +1,7 @@
+2014-05-29  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* Makefile.in (LIB_PTHREAD_SIGMASK): Remove; all uses removed.
+
 2014-05-26  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Include sources used to create macuvs.h.

=== modified file 'src/Makefile.in'
--- src/Makefile.in	2014-05-26 15:48:28 +0000
+++ src/Makefile.in	2014-05-29 04:12:16 +0000
@@ -121,7 +121,7 @@
 ## -lm, or empty.
 LIB_MATH=@LIB_MATH@
 
-## -lpthreads, or empty.
+## -lpthread, or empty.
 LIB_PTHREAD=@LIB_PTHREAD@
 
 LIBIMAGE=@LIBTIFF@ @LIBJPEG@ @LIBPNG@ @LIBGIF@ @LIBXPM@
@@ -286,8 +286,6 @@
 LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
 LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
 
-LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
-
 INTERVALS_H = dispextern.h intervals.h composite.h
 
 GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
@@ -409,7 +407,7 @@
    $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
    $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
    $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
-   $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
+   $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) \
    $(GFILENOTIFY_LIBS) $(LIB_MATH) $(LIBZ)
 
 all: emacs$(EXEEXT) $(OTHER_FILES)


  parent reply	other threads:[~2014-05-29  4:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 15:52 bug#17561: 24.4.50; Emacs can forget processes Jorgen Schaefer
2014-05-23 16:28 ` bug#17561: " Paul Eggert
2014-05-23 16:44   ` Jorgen Schaefer
2014-05-24 23:01     ` Paul Eggert
2014-05-25  7:57       ` Jorgen Schaefer
2014-05-26 17:08         ` Paul Eggert
2014-05-26 18:49           ` Jorgen Schaefer
2014-05-26 23:58             ` Paul Eggert
2014-05-27 18:27               ` Jorgen Schaefer
2014-05-27 21:42                 ` Paul Eggert
2014-05-27 22:16                   ` Jorgen Schaefer
2014-05-28  0:47                     ` Paul Eggert
2014-05-28 20:53                       ` Jorgen Schaefer
2014-05-28 23:00                         ` Paul Eggert
2014-05-28 23:35                           ` Jorgen Schaefer
2014-05-29  1:22                             ` Paul Eggert
2014-05-29 10:08                               ` Jorgen Schaefer
2014-05-29 23:15                                 ` Paul Eggert
2014-05-29  4:17                             ` Paul Eggert [this message]
2014-05-29 11:39                               ` Jorgen Schaefer
2014-05-29 15:09                                 ` Paul Eggert
2014-05-29 15:22                                   ` Andreas Schwab
2014-05-29 15:26                                     ` Paul Eggert
2014-05-29 17:03                                       ` Jorgen Schaefer
2014-05-29 17:55                                         ` Andreas Schwab
2014-05-29 18:23                                           ` Jorgen Schaefer
2014-05-29 19:06                                             ` Jorgen Schaefer
2014-05-29 20:27                                               ` Andreas Schwab
2014-05-29 19:15                                             ` Andreas Schwab
2014-05-30  6:07                                               ` Paul Eggert
2014-05-30 20:41                                                 ` Jorgen Schaefer
2014-05-30 21:29                                                   ` Paul Eggert
2014-05-27  4:05             ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5386B4E4.4070100@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=17561@debbugs.gnu.org \
    --cc=forcer@forcix.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.