GNU bug report logs - #6079
24.0.50; set-process-sentinel doesn't work inside sentinels

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Sun, 2 May 2010 12:09:01 UTC

Severity: normal

Tags: moreinfo

Found in version 24.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 6079 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 6079 <at> debbugs.gnu.org
Subject: Re: bug#6079: 24.0.50; set-process-sentinel doesn't work inside
 sentinels
Date: Wed, 21 Aug 2019 16:58:21 -0700
Helmut Eller <eller.helmut <at> gmail.com> writes:

> set-process-sentinel can't be used inside sentinels because
> exec_sentinel_unwind always restores the old value.  This code 
>
> (let* ((proc (start-process "foo" nil "/bin/bash" "-c" "sleep 100"))
>        (a-called nil)
>        (sentinel-a (lambda (proc msg)
>                      (message "a: %s" msg)
>                      (setq a-called t)))
>        (b-called nil)
>        (sentinel-b (lambda (proc msg)
>                      (message "b: %s" msg)
>                      (set-process-sentinel proc sentinel-a)
>                      (setq b-called t))))
>   (set-process-sentinel proc sentinel-b)
>   (signal-process proc 'SIGSTOP)
>   (message "waiting for b")
>   (while (not b-called)
>     (accept-process-output proc))
>   (signal-process proc 'SIGKILL)
>   (message "waiting for a")
>   (while (not a-called)
>     (accept-process-output proc)))
>
> prints:
>
>   waiting for b
>   b: stopped (signal)
>   waiting for a
>   b: killed
>
> which means that sentinel-b was called twice.  Since sentinel-b sets the
> the process sentinel to sentinel-a I would expect that sentinel-b can
> only be called once.

(I'm going through old bug reports that have unfortunately gotten no
attention yet.)

I tried reproducing this bug in Emacs 27, but I get:

waiting for b
b: stopped (signal)

waiting for a
a: killed

The exec_sentinel_unwind function no longer exists in Emacs, so the code
in this area has changed in the nine years since you reported this bug.

Do you still see this bug in more modern Emacs versions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 218 days ago.

Previous Next


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