unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>, Robert Pluim <rpluim@gmail.com>
Cc: gerd.moellmann@gmail.com, 58960-done@debbugs.gnu.org,
	tino.calancha@gmail.com
Subject: bug#58960: 29.0.50; Assert fails when browsing an URL, bug#58960: 29.0.50; Assert fails when browsing an URL
Date: Wed, 2 Nov 2022 13:29:39 -0700	[thread overview]
Message-ID: <b1a0dfdc-24fc-e86d-fee9-f60712e58c2c@cs.ucla.edu> (raw)
In-Reply-To: <83k04d9yva.fsf@gnu.org>

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

On 11/2/22 08:09, Eli Zaretskii wrote:
>> Why canʼt we just call `child_signal_init' from `init_process_emacs'
>> instead of `create_process'?
> Maybe we could.  Assuming the signal stuff is already set so early, I
> don't know exactly how posix_spawn works.

child_signal_init is reasonably heavyweight in that it keeps a couple of 
file descriptors open, so the idea is to be lazy and not call it unless 
Emacs plans to have children.

I installed the attached, which is like Robert's patch except it keeps 
the critical section smaller and checks the declaration of the 
now-extern function. Please give it a try. I'll boldly close the bug 
report; we can reopen it if I'm wrong.

[-- Attachment #2: 0001-Initialize-child-signal-handling-before-posix_spawn-.patch --]
[-- Type: text/x-patch, Size: 2157 bytes --]

From 05f5d978ae70c4849a5c47865d62301d27317a8a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 2 Nov 2022 13:24:26 -0700
Subject: [PATCH] Initialize child signal handling before posix_spawn too.

Problem reported by Tino Calancha (Bug#58960).
* src/callproc.c (call_process): Initialize SIGCHLD handling
before possibly creating a child with emacs_span.  This need not
be in the critical section that calls emacs_spawn, so do it
outside the critical section.
* src/process.c (child_signal_init): Now extern.
---
 src/callproc.c | 1 +
 src/lisp.h     | 1 +
 src/process.c  | 3 +--
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/callproc.c b/src/callproc.c
index 4d4b86629c..f9f840e544 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -648,6 +648,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
 
 #ifndef MSDOS
 
+  child_signal_init ();
   block_input ();
   block_child_signal (&oldset);
 
diff --git a/src/lisp.h b/src/lisp.h
index d87f954938..eafa241adf 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4915,6 +4915,7 @@ #define DAEMON_RUNNING (w32_daemon_event != INVALID_HANDLE_VALUE)
 
 /* Defined in process.c.  */
 struct Lisp_Process;
+extern void child_signal_init (void);
 extern void kill_buffer_processes (Lisp_Object);
 extern int wait_reading_process_output (intmax_t, int, int, bool, Lisp_Object,
 					struct Lisp_Process *, int);
diff --git a/src/process.c b/src/process.c
index 358899cded..5144c5d6c9 100644
--- a/src/process.c
+++ b/src/process.c
@@ -292,7 +292,6 @@ network_lookup_address_info_1 (Lisp_Object host, const char *service,
    descriptor to notify `wait_reading_process_output' of process
    status changes.  */
 static int child_signal_write_fd = -1;
-static void child_signal_init (void);
 #ifndef WINDOWSNT
 static void child_signal_read (int, void *);
 #endif
@@ -7323,7 +7322,7 @@ DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0,
 
 /* Set up `child_signal_read_fd' and `child_signal_write_fd'.  */
 
-static void
+void
 child_signal_init (void)
 {
   /* Either both are initialized, or both are uninitialized.  */
-- 
2.38.1


  reply	other threads:[~2022-11-02 20:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  4:48 bug#58960: 29.0.50; Assert fails when browsing an URL Tino Calancha
2022-11-02  5:14 ` Gerd Möllmann
2022-11-02 10:20 ` bug#58960: 29.0.50; Assert fails when browsing an URL, " Robert Pluim
2022-11-02 13:10   ` Eli Zaretskii
2022-11-02 13:58     ` Robert Pluim
2022-11-02 15:09       ` Eli Zaretskii
2022-11-02 20:29         ` Paul Eggert [this message]
2022-11-03  3:00           ` Tino Calancha
2022-11-03  8:41             ` Robert Pluim

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=b1a0dfdc-24fc-e86d-fee9-f60712e58c2c@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=58960-done@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=rpluim@gmail.com \
    --cc=tino.calancha@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).