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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6079 in the body.
You can then email your comments to 6079 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6079; Package emacs. (Sun, 02 May 2010 12:09:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Helmut Eller <eller.helmut <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 02 May 2010 12:09:01 GMT) Full text and rfc822 format available.

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

From: Helmut Eller <eller.helmut <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; set-process-sentinel doesn't work inside sentinels
Date: Sun, 02 May 2010 14:07:52 +0200
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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6079; Package emacs. (Wed, 21 Aug 2019 23:59:02 GMT) Full text and rfc822 format available.

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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 22 Aug 2019 00:00:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6079; Package emacs. (Mon, 14 Oct 2019 05:59:01 GMT) Full text and rfc822 format available.

Message #13 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: Mon, 14 Oct 2019 07:58:02 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> 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?

More information was requested some weeks back, but no response was
given, so I'm closing this bug report.

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




bug closed, send any further explanations to 6079 <at> debbugs.gnu.org and Helmut Eller <eller.helmut <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 14 Oct 2019 05:59:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 11 Nov 2019 12:24:13 GMT) Full text and rfc822 format available.

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.