summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorgson <gson@pkgsrc.org>2016-03-05 15:31:45 +0000
committergson <gson@pkgsrc.org>2016-03-05 15:31:45 +0000
commit9207ffb9d3be7d2c7adb5c7a652e418394c462f3 (patch)
treec0f725a11f7afe1409146a01545de98c797c0112 /editors
parentc01777cbd9dfbd8c3e091661cd76973b676bcac8 (diff)
downloadpkgsrc-9207ffb9d3be7d2c7adb5c7a652e418394c462f3.tar.gz
Don't call printf from a signal handler. Fixes emacs bug#22790.
Changes back-ported from emacs-25.0.92. Bump PKGREVISION.
Diffstat (limited to 'editors')
-rw-r--r--editors/emacs24/Makefile4
-rw-r--r--editors/emacs24/distinfo3
-rw-r--r--editors/emacs24/patches/patch-src_keyboard.c125
3 files changed, 129 insertions, 3 deletions
diff --git a/editors/emacs24/Makefile b/editors/emacs24/Makefile
index 3a1afd8a62c..7b92ace82f6 100644
--- a/editors/emacs24/Makefile
+++ b/editors/emacs24/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.43 2015/12/28 13:31:37 bsiegert Exp $
+# $NetBSD: Makefile,v 1.44 2016/03/05 15:31:45 gson Exp $
CONFLICTS+= emacs24-nox11-[0-9]*
-PKGREVISION= 8
+PKGREVISION= 9
.include "../../editors/emacs24/Makefile.common"
.include "options.mk"
diff --git a/editors/emacs24/distinfo b/editors/emacs24/distinfo
index 5b113507a90..22141261e35 100644
--- a/editors/emacs24/distinfo
+++ b/editors/emacs24/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.20 2015/11/03 03:32:16 agc Exp $
+$NetBSD: distinfo,v 1.21 2016/03/05 15:31:45 gson Exp $
SHA1 (emacs-24.5.tar.gz) = 806e80eefa2ca89d2f8c0917f8b61c5c87af4f2d
RMD160 (emacs-24.5.tar.gz) = 50a778a959db89b127970c1173dbe351671eb48b
@@ -6,3 +6,4 @@ SHA512 (emacs-24.5.tar.gz) = fa08dd1f08bf59746e120118cfa0657dec357868570d073d28a
Size (emacs-24.5.tar.gz) = 59216034 bytes
SHA1 (patch-gnu_readlinkat.c) = 9252c92290ccf1d4094bbd3972d8309ebf9e57d6
SHA1 (patch-src_inotify.c) = 9dfddb9db39e84f376cad1d5a5a32861e7838cac
+SHA1 (patch-src_keyboard.c) = 04e7bb89ef6dcf3f9b5fd1c16314a3396f3d33f4
diff --git a/editors/emacs24/patches/patch-src_keyboard.c b/editors/emacs24/patches/patch-src_keyboard.c
new file mode 100644
index 00000000000..471f52e7ff7
--- /dev/null
+++ b/editors/emacs24/patches/patch-src_keyboard.c
@@ -0,0 +1,125 @@
+$NetBSD: patch-src_keyboard.c,v 1.1 2016/03/05 15:31:45 gson Exp $
+
+Don't call printf from a signal handler. Fixes emacs bug#22790.
+Changes back-ported from emacs-25.0.92.
+
+--- src/keyboard.c.orig 2015-04-02 07:23:06.000000000 +0000
++++ src/keyboard.c
+@@ -10295,6 +10295,21 @@ deliver_interrupt_signal (int sig)
+ deliver_process_signal (sig, handle_interrupt_signal);
+ }
+
++/* Output MSG directly to standard output, without buffering. Ignore
++ failures. This is safe in a signal handler. */
++static void
++write_stdout (char const *msg)
++{
++ (void) (write (STDOUT_FILENO, msg, strlen (msg)));
++}
++
++/* Read a byte from stdin, without buffering. Safe in signal handlers. */
++static int
++read_stdin (void)
++{
++ char c;
++ return read (STDIN_FILENO, &c, 1) == 1 ? c : EOF;
++}
+
+ /* If Emacs is stuck because `inhibit-quit' is true, then keep track
+ of the number of times C-g has been requested. If C-g is pressed
+@@ -10331,9 +10346,9 @@ handle_interrupt (bool in_signal_handler
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGINT);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
++ fflush (stdout);
+ }
+
+- fflush (stdout);
+ reset_all_sys_modes ();
+
+ #ifdef SIGTSTP
+@@ -10349,8 +10364,9 @@ handle_interrupt (bool in_signal_handler
+ /* Perhaps should really fork an inferior shell?
+ But that would not provide any way to get back
+ to the original shell, ever. */
+- printf ("No support for stopping a process on this operating system;\n");
+- printf ("you can continue or abort.\n");
++ write_stdout ("No support for stopping a process"
++ " on this operating system;\n"
++ "you can continue or abort.\n");
+ #endif /* not SIGTSTP */
+ #ifdef MSDOS
+ /* We must remain inside the screen area when the internal terminal
+@@ -10361,46 +10377,49 @@ handle_interrupt (bool in_signal_handler
+ the code used for auto-saving doesn't cope with the mark bit. */
+ if (!gc_in_progress)
+ {
+- printf ("Auto-save? (y or n) ");
+- fflush (stdout);
+- if (((c = getchar ()) & ~040) == 'Y')
++ write_stdout ("Auto-save? (y or n) ");
++ c = read_stdin ();
++ if (c == 'y' || c == 'Y')
+ {
+ Fdo_auto_save (Qt, Qnil);
+ #ifdef MSDOS
+- printf ("\r\nAuto-save done");
+-#else /* not MSDOS */
+- printf ("Auto-save done\n");
+-#endif /* not MSDOS */
++ write_stdout ("\r\nAuto-save done");
++#else
++ write_stdout ("Auto-save done\n");
++#endif
+ }
+- while (c != '\n') c = getchar ();
++ while (c != '\n')
++ c = read_stdin ();
+ }
+ else
+ {
+ /* During GC, it must be safe to reenable quitting again. */
+ Vinhibit_quit = Qnil;
++ write_stdout
++ (
+ #ifdef MSDOS
+- printf ("\r\n");
+-#endif /* not MSDOS */
+- printf ("Garbage collection in progress; cannot auto-save now\r\n");
+- printf ("but will instead do a real quit after garbage collection ends\r\n");
+- fflush (stdout);
++ "\r\n"
++#endif
++ "Garbage collection in progress; cannot auto-save now\r\n"
++ "but will instead do a real quit"
++ " after garbage collection ends\r\n");
+ }
+
+ #ifdef MSDOS
+- printf ("\r\nAbort? (y or n) ");
+-#else /* not MSDOS */
+- printf ("Abort (and dump core)? (y or n) ");
+-#endif /* not MSDOS */
+- fflush (stdout);
+- if (((c = getchar ()) & ~040) == 'Y')
++ write_stdout ("\r\nAbort? (y or n) ");
++#else
++ write_stdout ("Abort (and dump core)? (y or n) ");
++#endif
++ c = read_stdin ();
++ if (c == 'y' || c == 'Y')
+ emacs_abort ();
+- while (c != '\n') c = getchar ();
++ while (c != '\n')
++ c = read_stdin ();
+ #ifdef MSDOS
+- printf ("\r\nContinuing...\r\n");
++ write_stdout ("\r\nContinuing...\r\n");
+ #else /* not MSDOS */
+- printf ("Continuing...\n");
++ write_stdout ("Continuing...\n");
+ #endif /* not MSDOS */
+- fflush (stdout);
+ init_all_sys_modes ();
+ }
+ else