* bug#1082: 23.0.60; read-char unexpectedly halts execution of script
@ 2008-10-04 17:58 Markus Triska
0 siblings, 0 replies; 12+ messages in thread
From: Markus Triska @ 2008-10-04 17:58 UTC (permalink / raw)
To: emacs-pretest-bug
Let filter.el consist of the forms:
(defun bc-filter (proc string)
(message "%s" string))
(message "starting")
(setq bc (start-process "bc" nil "/usr/bin/bc"))
(set-process-filter bc 'bc-filter)
(while t
(let ((char (read-char nil nil 0.1)))
(message "char: %s" char)))
Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
mt-computer:~ mt$ emacs --script filter.el
starting
mt-computer:~ mt$
I expect non-termination in this case, as in eval-buffer on filter.el.
In GNU Emacs 23.0.60.1 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
of 2008-09-24 on mt-computer.local
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
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_GB.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: nil
default-enable-multibyte-characters: t
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: 23.0.60; read-char unexpectedly halts execution of script
@ 2008-10-06 19:08 Chong Yidong
2008-10-06 19:34 ` bug#1082: " Lennart Borgman (gmail)
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Chong Yidong @ 2008-10-06 19:08 UTC (permalink / raw)
To: emacs-devel; +Cc: 1082
> Let filter.el consist of the forms:
>
> (defun bc-filter (proc string)
> (message "%s" string))
>
> (message "starting")
> (setq bc (start-process "bc" nil "/usr/bin/bc"))
> (set-process-filter bc 'bc-filter)
>
> (while t
> (let ((char (read-char nil nil 0.1)))
> (message "char: %s" char)))
>
> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>
> mt-computer:~ mt$ emacs --script filter.el
> starting
> mt-computer:~ mt$
>
> I expect non-termination in this case, as in eval-buffer on filter.el.
This broke when SYNC_INPUT became the default; it works when Emacs is
recompiled without SYNC_INPUT, like Emacs 22.
I don't know what the specific cause of failure is, however. Maybe the
SYNC_INPUT code should only be active when Emacs is run interactively.
Thoughts?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#1082: 23.0.60; read-char unexpectedly halts execution of script
@ 2008-10-06 19:08 Chong Yidong
0 siblings, 0 replies; 12+ messages in thread
From: Chong Yidong @ 2008-10-06 19:08 UTC (permalink / raw)
To: emacs-devel; +Cc: 1082
> Let filter.el consist of the forms:
>
> (defun bc-filter (proc string)
> (message "%s" string))
>
> (message "starting")
> (setq bc (start-process "bc" nil "/usr/bin/bc"))
> (set-process-filter bc 'bc-filter)
>
> (while t
> (let ((char (read-char nil nil 0.1)))
> (message "char: %s" char)))
>
> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>
> mt-computer:~ mt$ emacs --script filter.el
> starting
> mt-computer:~ mt$
>
> I expect non-termination in this case, as in eval-buffer on filter.el.
This broke when SYNC_INPUT became the default; it works when Emacs is
recompiled without SYNC_INPUT, like Emacs 22.
I don't know what the specific cause of failure is, however. Maybe the
SYNC_INPUT code should only be active when Emacs is run interactively.
Thoughts?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#1082: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 19:08 23.0.60; read-char unexpectedly halts execution of script Chong Yidong
@ 2008-10-06 19:34 ` Lennart Borgman (gmail)
2008-10-06 19:34 ` Lennart Borgman (gmail)
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Lennart Borgman (gmail) @ 2008-10-06 19:34 UTC (permalink / raw)
To: Chong Yidong, 1082; +Cc: emacs-devel
Chong Yidong wrote:
>> Let filter.el consist of the forms:
>>
>> (defun bc-filter (proc string)
>> (message "%s" string))
>>
>> (message "starting")
>> (setq bc (start-process "bc" nil "/usr/bin/bc"))
>> (set-process-filter bc 'bc-filter)
>>
>> (while t
>> (let ((char (read-char nil nil 0.1)))
>> (message "char: %s" char)))
>>
>> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>>
>> mt-computer:~ mt$ emacs --script filter.el
>> starting
>> mt-computer:~ mt$
>>
>> I expect non-termination in this case, as in eval-buffer on filter.el.
>
> This broke when SYNC_INPUT became the default; it works when Emacs is
> recompiled without SYNC_INPUT, like Emacs 22.
>
> I don't know what the specific cause of failure is, however. Maybe the
> SYNC_INPUT code should only be active when Emacs is run interactively.
>
> Thoughts?
What is the while loop supposed to do? I tested just that and I got a
bit weird results.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: bug#1082: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 19:08 23.0.60; read-char unexpectedly halts execution of script Chong Yidong
2008-10-06 19:34 ` bug#1082: " Lennart Borgman (gmail)
@ 2008-10-06 19:34 ` Lennart Borgman (gmail)
2008-10-06 19:35 ` Chong Yidong
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Lennart Borgman (gmail) @ 2008-10-06 19:34 UTC (permalink / raw)
To: Chong Yidong, 1082; +Cc: emacs-devel
Chong Yidong wrote:
>> Let filter.el consist of the forms:
>>
>> (defun bc-filter (proc string)
>> (message "%s" string))
>>
>> (message "starting")
>> (setq bc (start-process "bc" nil "/usr/bin/bc"))
>> (set-process-filter bc 'bc-filter)
>>
>> (while t
>> (let ((char (read-char nil nil 0.1)))
>> (message "char: %s" char)))
>>
>> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>>
>> mt-computer:~ mt$ emacs --script filter.el
>> starting
>> mt-computer:~ mt$
>>
>> I expect non-termination in this case, as in eval-buffer on filter.el.
>
> This broke when SYNC_INPUT became the default; it works when Emacs is
> recompiled without SYNC_INPUT, like Emacs 22.
>
> I don't know what the specific cause of failure is, however. Maybe the
> SYNC_INPUT code should only be active when Emacs is run interactively.
>
> Thoughts?
What is the while loop supposed to do? I tested just that and I got a
bit weird results.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#1082: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 19:08 23.0.60; read-char unexpectedly halts execution of script Chong Yidong
` (2 preceding siblings ...)
2008-10-06 19:35 ` Chong Yidong
@ 2008-10-06 19:35 ` Chong Yidong
2008-10-06 21:28 ` Andreas Schwab
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Chong Yidong @ 2008-10-06 19:35 UTC (permalink / raw)
To: emacs-devel; +Cc: 1082
Chong Yidong <cyd@stupidchicken.com> writes:
>> Let filter.el consist of the forms:
>>
>> (defun bc-filter (proc string)
>> (message "%s" string))
>>
>> (message "starting")
>> (setq bc (start-process "bc" nil "/usr/bin/bc"))
>> (set-process-filter bc 'bc-filter)
>>
>> (while t
>> (let ((char (read-char nil nil 0.1)))
>> (message "char: %s" char)))
>>
>> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>>
>> mt-computer:~ mt$ emacs --script filter.el
>> starting
>> mt-computer:~ mt$
>>
>> I expect non-termination in this case
>
> This broke when SYNC_INPUT became the default.
To pin it down further, this breakage seems to be due to not using
SA_RESTART in the signal handler. If we set SA_RESTARTi in sysdep.c,
the problem disappears. Stefan, could you comment?
signal_handler_t
sys_signal (int signal_number, signal_handler_t action)
{
struct sigaction new_action, old_action;
sigemptyset (&new_action.sa_mask);
new_action.sa_handler = action;
#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) && !defined(SYNC_INPUT)
/* Emacs mostly works better with restartable system services. If this
flag exists, we probably want to turn it on here.
However, on some systems this resets the timeout of `select'
which means that `select' never finishes if it keeps getting signals.
BROKEN_SA_RESTART is defined on those systems. */
/* It's not clear why the comment above says "mostly works better". --Stef
When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll
for pending input so we need long-running syscalls to be interrupted
after a signal that sets the interrupt_input_pending flag. */
new_action.sa_flags = SA_RESTART;
#else
new_action.sa_flags = 0;
#endif
sigaction (signal_number, &new_action, &old_action);
return (old_action.sa_handler);
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 19:08 23.0.60; read-char unexpectedly halts execution of script Chong Yidong
2008-10-06 19:34 ` bug#1082: " Lennart Borgman (gmail)
2008-10-06 19:34 ` Lennart Borgman (gmail)
@ 2008-10-06 19:35 ` Chong Yidong
2008-10-06 19:35 ` bug#1082: " Chong Yidong
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Chong Yidong @ 2008-10-06 19:35 UTC (permalink / raw)
To: emacs-devel; +Cc: 1082
Chong Yidong <cyd@stupidchicken.com> writes:
>> Let filter.el consist of the forms:
>>
>> (defun bc-filter (proc string)
>> (message "%s" string))
>>
>> (message "starting")
>> (setq bc (start-process "bc" nil "/usr/bin/bc"))
>> (set-process-filter bc 'bc-filter)
>>
>> (while t
>> (let ((char (read-char nil nil 0.1)))
>> (message "char: %s" char)))
>>
>> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>>
>> mt-computer:~ mt$ emacs --script filter.el
>> starting
>> mt-computer:~ mt$
>>
>> I expect non-termination in this case
>
> This broke when SYNC_INPUT became the default.
To pin it down further, this breakage seems to be due to not using
SA_RESTART in the signal handler. If we set SA_RESTARTi in sysdep.c,
the problem disappears. Stefan, could you comment?
signal_handler_t
sys_signal (int signal_number, signal_handler_t action)
{
struct sigaction new_action, old_action;
sigemptyset (&new_action.sa_mask);
new_action.sa_handler = action;
#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) && !defined(SYNC_INPUT)
/* Emacs mostly works better with restartable system services. If this
flag exists, we probably want to turn it on here.
However, on some systems this resets the timeout of `select'
which means that `select' never finishes if it keeps getting signals.
BROKEN_SA_RESTART is defined on those systems. */
/* It's not clear why the comment above says "mostly works better". --Stef
When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll
for pending input so we need long-running syscalls to be interrupted
after a signal that sets the interrupt_input_pending flag. */
new_action.sa_flags = SA_RESTART;
#else
new_action.sa_flags = 0;
#endif
sigaction (signal_number, &new_action, &old_action);
return (old_action.sa_handler);
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#1082: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 19:08 23.0.60; read-char unexpectedly halts execution of script Chong Yidong
` (4 preceding siblings ...)
2008-10-06 21:28 ` Andreas Schwab
@ 2008-10-06 21:28 ` Andreas Schwab
[not found] ` <mailman.409.1223329803.25473.bug-gnu-emacs@gnu.org>
6 siblings, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2008-10-06 21:28 UTC (permalink / raw)
To: Chong Yidong; +Cc: 1082, emacs-devel
Chong Yidong <cyd@stupidchicken.com> writes:
>> Let filter.el consist of the forms:
>>
>> (defun bc-filter (proc string)
>> (message "%s" string))
>>
>> (message "starting")
>> (setq bc (start-process "bc" nil "/usr/bin/bc"))
>> (set-process-filter bc 'bc-filter)
>>
>> (while t
>> (let ((char (read-char nil nil 0.1)))
>> (message "char: %s" char)))
>>
>> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>>
>> mt-computer:~ mt$ emacs --script filter.el
>> starting
>> mt-computer:~ mt$
>>
>> I expect non-termination in this case, as in eval-buffer on filter.el.
>
> This broke when SYNC_INPUT became the default; it works when Emacs is
> recompiled without SYNC_INPUT, like Emacs 22.
>
> I don't know what the specific cause of failure is, however. Maybe the
> SYNC_INPUT code should only be active when Emacs is run interactively.
>
> Thoughts?
In non-interactive mode we always want restartable syscalls, since
keyboard input goes through stdio (SYNC_INPUT makes no difference here).
I've checked in a fix.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 19:08 23.0.60; read-char unexpectedly halts execution of script Chong Yidong
` (3 preceding siblings ...)
2008-10-06 19:35 ` bug#1082: " Chong Yidong
@ 2008-10-06 21:28 ` Andreas Schwab
2008-10-07 2:09 ` Stefan Monnier
2008-10-07 2:09 ` bug#1082: " Stefan Monnier
2008-10-06 21:28 ` Andreas Schwab
[not found] ` <mailman.409.1223329803.25473.bug-gnu-emacs@gnu.org>
6 siblings, 2 replies; 12+ messages in thread
From: Andreas Schwab @ 2008-10-06 21:28 UTC (permalink / raw)
To: Chong Yidong; +Cc: 1082, emacs-devel
Chong Yidong <cyd@stupidchicken.com> writes:
>> Let filter.el consist of the forms:
>>
>> (defun bc-filter (proc string)
>> (message "%s" string))
>>
>> (message "starting")
>> (setq bc (start-process "bc" nil "/usr/bin/bc"))
>> (set-process-filter bc 'bc-filter)
>>
>> (while t
>> (let ((char (read-char nil nil 0.1)))
>> (message "char: %s" char)))
>>
>> Where "/usr/bin/bc" is the GNU arbitrary precision calculator. Now:
>>
>> mt-computer:~ mt$ emacs --script filter.el
>> starting
>> mt-computer:~ mt$
>>
>> I expect non-termination in this case, as in eval-buffer on filter.el.
>
> This broke when SYNC_INPUT became the default; it works when Emacs is
> recompiled without SYNC_INPUT, like Emacs 22.
>
> I don't know what the specific cause of failure is, however. Maybe the
> SYNC_INPUT code should only be active when Emacs is run interactively.
>
> Thoughts?
In non-interactive mode we always want restartable syscalls, since
keyboard input goes through stdio (SYNC_INPUT makes no difference here).
I've checked in a fix.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#1082: 23.0.60; read-char unexpectedly halts execution of script
[not found] ` <mailman.409.1223329803.25473.bug-gnu-emacs@gnu.org>
@ 2008-10-06 22:17 ` Markus Triska
0 siblings, 0 replies; 12+ messages in thread
From: Markus Triska @ 2008-10-06 22:17 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 1082
Andreas Schwab <schwab@suse.de> writes:
> In non-interactive mode we always want restartable syscalls, since
> keyboard input goes through stdio (SYNC_INPUT makes no difference here).
> I've checked in a fix.
Thank you, it fixes this problem for me. Could process output also be
handled, as in interactive use? E.g., M-x eval-region on the forms:
(defun bc-filter (proc string)
(message "%s" string))
(message "starting")
(setq bc (start-process "bc" nil "/usr/bin/bc"))
(set-process-filter bc 'bc-filter)
(while t
(let ((char (read-char nil nil 0.1)))
(when char
(message "char: %s" char))))
processes the output of bc, and shows:
starting
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
Whereas in "emacs --script" mode, this output is not shown.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#1082: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 21:28 ` Andreas Schwab
2008-10-07 2:09 ` Stefan Monnier
@ 2008-10-07 2:09 ` Stefan Monnier
1 sibling, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2008-10-07 2:09 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 1082, Chong Yidong, emacs-devel
> In non-interactive mode we always want restartable syscalls, since
> keyboard input goes through stdio (SYNC_INPUT makes no difference here).
> I've checked in a fix.
Thank you. Could you add a comment explaining why we test
`noninteractive' at that spot, please?
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: 23.0.60; read-char unexpectedly halts execution of script
2008-10-06 21:28 ` Andreas Schwab
@ 2008-10-07 2:09 ` Stefan Monnier
2008-10-07 2:09 ` bug#1082: " Stefan Monnier
1 sibling, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2008-10-07 2:09 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 1082, Chong Yidong, emacs-devel
> In non-interactive mode we always want restartable syscalls, since
> keyboard input goes through stdio (SYNC_INPUT makes no difference here).
> I've checked in a fix.
Thank you. Could you add a comment explaining why we test
`noninteractive' at that spot, please?
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-10-07 2:09 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-06 19:08 23.0.60; read-char unexpectedly halts execution of script Chong Yidong
2008-10-06 19:34 ` bug#1082: " Lennart Borgman (gmail)
2008-10-06 19:34 ` Lennart Borgman (gmail)
2008-10-06 19:35 ` Chong Yidong
2008-10-06 19:35 ` bug#1082: " Chong Yidong
2008-10-06 21:28 ` Andreas Schwab
2008-10-07 2:09 ` Stefan Monnier
2008-10-07 2:09 ` bug#1082: " Stefan Monnier
2008-10-06 21:28 ` Andreas Schwab
[not found] ` <mailman.409.1223329803.25473.bug-gnu-emacs@gnu.org>
2008-10-06 22:17 ` Markus Triska
-- strict thread matches above, loose matches on Subject: below --
2008-10-06 19:08 Chong Yidong
2008-10-04 17:58 Markus Triska
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.