GNU bug report logs - #79367
31.0.50; magit-commit sometimes doesn't work if diff-hl-update-async is t

Previous Next

Package: emacs;

Reported by: Zhengyi Fu <i <at> fuzy.me>

Date: Tue, 2 Sep 2025 06:21:01 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Zhengyi Fu <i <at> fuzy.me>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: sbaugh <at> janestreet.com, 79367 <at> debbugs.gnu.org, dmitry <at> gutov.dev
Subject: bug#79367: 31.0.50; magit-commit sometimes doesn't work if diff-hl-update-async is t
Date: Wed, 03 Sep 2025 22:42:26 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: i <at> fuzy.me, dmitry <at> gutov.dev, 79367 <at> debbugs.gnu.org
>> Date: Wed, 03 Sep 2025 14:25:58 +0300
>> From: Eli Zaretskii <eliz <at> gnu.org>
>> 
>> > >   . if the process on behalf of which we called
>> > >     server_accept_connection was not locked to some thread, undo what
>> > >     make_process did to the new process when it called pset_thread
>> > >   . otherwise, call set_proc_thread to lock the new process to the
>> > >     same thread as the one which caused this call
>> > 
>> > Whatever you do, please post your change for review rather than just
>> > pushing it.
>> 
>> Will do.
>
> The proposed patch is below.
>
> Zhengyi Fu, can you please apply it to the current master, and see if
> it solves the original problem?

It does resolve my original problem.  But I think we need to call
set_proc_thread when the server process is not locked as well.
Otherwise the `thread' member of the fd_callback_info may still be a
dangling pointer.

> diff --git a/src/process.c b/src/process.c
> index d6efac5..0c41ec6 100644
> --- a/src/process.c
> +++ b/src/process.c
> @@ -5078,6 +5078,10 @@ server_accept_connection (Lisp_Object server, int channel)
>    fcntl (s, F_SETFL, O_NONBLOCK);
>  
>    p = XPROCESS (proc);
> +  /* make_process calls pset_thread, but if the server process is not
> +     locked to any thread, we need to undo what make_process did.  */
> +  if (NILP (ps->thread))
> +    pset_thread (p, Qnil);
>  
>    /* Build new contact information for this setup.  */
>    contact = Fcopy_sequence (ps->childp);
> @@ -5117,6 +5121,13 @@ server_accept_connection (Lisp_Object server, int channel)
>      add_process_read_fd (s);
>    if (s > max_desc)
>      max_desc = s;
> +  /* If the server process is locked to this thread, lock the client
> +     process to the same thread.  */
> +  if (!NILP (ps->thread))
> +    {
> +      eassert (XTHREAD (ps->thread) == current_thread);
> +      set_proc_thread (p, XTHREAD (ps->thread));
> +    }
>  
>    /* Setup coding system for new process based on server process.
>       This seems to be the proper thing to do, as the coding system




This bug report was last modified 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.