GNU bug report logs - #2930
23.0.92; `accept-process-output' and `sleep-for' do not run sentinels

Previous Next

Package: emacs;

Reported by: Markus Triska <markus.triska <at> gmx.at>

Date: Wed, 8 Apr 2009 18:40:05 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

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 2930 in the body.
You can then email your comments to 2930 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 bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Wed, 08 Apr 2009 18:40:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 08 Apr 2009 18:40:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
Date: Wed, 08 Apr 2009 20:30:25 +0200
The documentation for sentinels states:

   A program can wait, so that sentinels will run, by calling
   `sit-for' or `sleep-for' (...), or `accept-process-output' (...).

However, when I do M-x eval-region RET on the following forms in
"emacs -Q", then Emacs loops unexpectedly:

   (defun my-sentinel (proc str)
     (setq my-finished t))

   (let ((p (start-process "bc" nil "bc"))
         my-finished)
     (set-process-sentinel p 'my-sentinel)
     (process-send-string p "quit\n")
     (while (not my-finished)
       (accept-process-output nil 0.1)))

When I replace the call of `accept-process-output' with (sleep-for
0.1), it also does not run the sentinel. (sit-for 0.1) works as
documented, but is not a good alternative for the other functions in
this case: If keyboard input is available, `sit-for' returns
immediately, so it is currently unfortunately also necessary to
discard keyboard input to make such a loop reliably run the sentinel.

In GNU Emacs 23.0.92.2 (i386-apple-darwin9.6.1, GTK+ Version 2.14.7)
 of 2009-04-05 on mt-imac.local
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--with-tiff=no''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Wed, 08 Apr 2009 21:15:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 08 Apr 2009 21:15:05 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 2930 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
Date: Wed, 08 Apr 2009 17:11:46 -0400
>    (let ((p (start-process "bc" nil "bc"))
>          my-finished)
>      (set-process-sentinel p 'my-sentinel)
>      (process-send-string p "quit\n")
>      (while (not my-finished)
>        (accept-process-output nil 0.1)))

What happens of you pass `p' to accept-process-output, as would
seem natural?


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Wed, 08 Apr 2009 21:15:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 08 Apr 2009 21:15:06 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Wed, 08 Apr 2009 21:35:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 08 Apr 2009 21:35:03 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: gnu-emacs-bug <at> moderators.isc.org
Subject: Re: bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
Date: Wed, 08 Apr 2009 23:29:33 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>>      (while (not my-finished)
>>        (accept-process-output nil 0.1)))
>
> What happens of you pass `p' to accept-process-output

It also loops, both with and without additional time-out, i.e.:

   (accept-process-output p)

and

   (accept-process-output p 0.1)

and not specifying any particular process all yield the same result.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Sun, 16 Aug 2009 02:05:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 16 Aug 2009 02:05:04 GMT) Full text and rfc822 format available.

Message #25 received at 2930 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier  <monnier <at> iro.umontreal.ca>
Cc: Markus Triska <markus.triska <at> gmx.at>, 2930 <at> debbugs.gnu.org
Subject: Re: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
Date: Sat, 15 Aug 2009 21:58:11 -0400
> The documentation for sentinels states:
>
>    A program can wait, so that sentinels will run, by calling
>    `sit-for' or `sleep-for' (...), or `accept-process-output' (...).
>
> However, when I do M-x eval-region RET on the following forms in
> "emacs -Q", then Emacs loops unexpectedly:
>
>    (defun my-sentinel (proc str)
>      (setq my-finished t))
>
>    (let ((p (start-process "bc" nil "bc"))
>          my-finished)
>      (set-process-sentinel p 'my-sentinel)
>      (process-send-string p "quit\n")
>      (while (not my-finished)
>        (accept-process-output nil 0.1)))

The trouble is that accept-process-output passes a zero DO_DISPLAY
argument to wait_reading_process_output (process.c:4306).  When
DO_DISPLAY is zero, status notifications are not performed
(process.c:4763).

Having accept-process-output pass a non-zero DO_DISPLAY argument to
wait_reading_process_output fixes this problem, but I don't know what
ramifications this would have.

Stefan, WDYT?



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Mon, 17 Aug 2009 15:45:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 17 Aug 2009 15:45:05 GMT) Full text and rfc822 format available.

Message #30 received at 2930 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Markus Triska <markus.triska <at> gmx.at>, 2930 <at> debbugs.gnu.org
Subject: Re: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
Date: Mon, 17 Aug 2009 11:36:56 -0400
>> The documentation for sentinels states:
>> A program can wait, so that sentinels will run, by calling
>> `sit-for' or `sleep-for' (...), or `accept-process-output' (...).
>> 
>> However, when I do M-x eval-region RET on the following forms in
>> "emacs -Q", then Emacs loops unexpectedly:
>> 
>> (defun my-sentinel (proc str)
>> (setq my-finished t))
>> 
>> (let ((p (start-process "bc" nil "bc"))
>> my-finished)
>> (set-process-sentinel p 'my-sentinel)
>> (process-send-string p "quit\n")
>> (while (not my-finished)
>> (accept-process-output nil 0.1)))

> The trouble is that accept-process-output passes a zero DO_DISPLAY
> argument to wait_reading_process_output (process.c:4306).  When
> DO_DISPLAY is zero, status notifications are not performed
> (process.c:4763).

> Having accept-process-output pass a non-zero DO_DISPLAY argument to
> wait_reading_process_output fixes this problem, but I don't know what
> ramifications this would have.

I don't know.  You already changed it in that direction a year ago:

   timestamp: Mon 2008-05-19 22:29:33 +0000
   message:
     (wait_reading_process_output): Always check status when in batch mode.

so maybe we should change it even further?  I think a good change would
be to change the code of wait_reading_process_output such that status
changes are taken into account (even when do_display is 0) but only for
the process(es) for which we're waiting.


        Stefan



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Mon, 17 Aug 2009 16:40:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 17 Aug 2009 16:40:06 GMT) Full text and rfc822 format available.

Message #35 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: gnu-emacs-bug <at> moderators.isc.org
Subject: Re: bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
Date: Mon, 17 Aug 2009 18:34:35 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> so maybe we should change it even further?  I think a good change would
> be to change the code of wait_reading_process_output such that status
> changes are taken into account (even when do_display is 0) but only for
> the process(es) for which we're waiting.

I agree, and I think that if no process at all is specified, then all
status changes should be processed. This is for consistency with regular
input processing: If there is input from some process, and no particular
process is specified, it will also be processed.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2930; Package emacs. (Thu, 20 Aug 2009 19:37:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 20 Aug 2009 19:37:05 GMT) Full text and rfc822 format available.

Message #40 received at 2930 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Markus Triska <markus.triska <at> gmx.at>, 2930 <at> debbugs.gnu.org
Subject: Re: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels
Date: Mon, 17 Aug 2009 17:04:10 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> I don't know.  You already changed it in that direction a year ago:
>
>    timestamp: Mon 2008-05-19 22:29:33 +0000
>    message:
>      (wait_reading_process_output): Always check status when in batch mode.
>
> so maybe we should change it even further?  I think a good change would
> be to change the code of wait_reading_process_output such that status
> changes are taken into account (even when do_display is 0) but only for
> the process(es) for which we're waiting.

OK, thanks for reminding me about Bug#131.  After re-reading that
discussion, I'm fairly sure that TRT is for wait_reading_process_output
to always check the process status (without triggering a redisplay
unless DO_DISPLAY is non-zero).  I've checked the change into CVS.



bug closed, send any further explanations to Markus Triska <markus.triska <at> gmx.at> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Thu, 20 Aug 2009 19:40:07 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Fri, 18 Sep 2009 14:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 276 days ago.

Previous Next


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