* term.el (term-emulate-terminal)
@ 2002-04-13 13:40 Harry Kuiper
2002-04-13 15:36 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Harry Kuiper @ 2002-04-13 13:40 UTC (permalink / raw)
This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.
Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.
In GNU Emacs 21.2.1 (i686-pc-linux-gnu, X toolkit)
of 2002-04-13 on mumon
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: C
locale-coding-system: nil
default-enable-multibyte-characters: t
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
After starting term-mode with M-x term the terminal hangs after
handling just a few commands causing Emacs to block and draw 100% CPU.
The more output the command produces the likelier the terminal is to
hang.
Under X: Emacs can not be stopped by typing C-g twice. Only by
killing it from an Xterminal.
At the console: Emacs stops after typing C-g twice and asks if it
should produce a dump. I answered yes but then Emacs crashed hard
without producing the dump it promised.
I looked at the diffs between term.el in Emacs-21.1 and Emacs-21.2
using these I backed out the change Eli Zaretskii made at 2002-02-03
(see below, something about matching terminal prompt). After that
term works OK again for me.
Apart from this little glitch I love Emacs-21.2. Thanks!
<<<<< Eli's changes I backed out. >>>>>
+ 2002-02-03 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * mail/rmail.el (rmail): Use find-buffer-visiting instead of
+ get-file-buffer to check for rmail buffer existence.
+
+ * term.el (term-emulate-terminal): Extract proper command string
+ which is supplied to term-command-hook.
+
--- 797,814 ----
*************** See `term-prompt-regexp'."
*** 2856,2864 ****
(beep t)) ; Bell
((eq char ?\032)
! (let ((end (string-match "\n" str i)))
(if end
(progn (funcall term-command-hook
! (substring str (1+ i) (1- end)))
! (setq i end))
(setq term-terminal-parameter
(substring str i))
--- 2831,2839 ----
(beep t)) ; Bell
((eq char ?\032)
! (let ((end (string-match "\r?$" str i)))
(if end
(progn (funcall term-command-hook
! (substring str (1+ i) end))
! (setq i (match-end 0)))
(setq term-terminal-parameter
(substring str i))
<<<<< End >>>>>
Recent input:
C-g C-x d t m <tab> <return> C-c $ <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> D y e s <return> <up> <up> D y
e s <return> <return> <next> <next> <next> <next> <next>
<next> <next> q C-/ C-x k <return> <down> <down> <up>
<up> <up> v C-s C-s t e r m . e l C-s C-s C-s C-s C-s
C-s C-r C-r C-a C-s C-s C-s C-r C-r C-a C-x 5 b * s
<tab> <return> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <help-menu> <report-emacs-b
ug>
Recent messages:
Undo!
Loading view...done
unzipping emacs-21.1-21.2.diff.gz...done
Loading diff-mode...
Loading easy-mmode...done
Loading diff-mode...done
Type C-h for help, h for commands, q to quit.
Mark saved where search started [2 times]
Loading emacsbug...done
Loading dabbrev...done
--
Harry Kuiper hkuiper@xs4all.nl
Haarlem, The Netherlands
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 13:40 term.el (term-emulate-terminal) Harry Kuiper
@ 2002-04-13 15:36 ` Eli Zaretskii
2002-04-13 17:25 ` Daiki Ueno
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2002-04-13 15:36 UTC (permalink / raw)
Cc: bug-gnu-emacs
> From: Harry Kuiper <hkuiper@xs4all.nl>
> Date: 13 Apr 2002 15:40:54 +0200
>
> I looked at the diffs between term.el in Emacs-21.1 and Emacs-21.2
> using these I backed out the change Eli Zaretskii made at 2002-02-03
> (see below, something about matching terminal prompt). After that
> term works OK again for me.
Actually, this change was suggested by Daiki Ueno; I was asked
(probably by Richard Stallman) to install it.
The bug which the change was supposed to fix is explained here:
http://mail.gnu.org/pipermail/bug-gnu-emacs/2002-January/010123.html
> <<<<< Eli's changes I backed out. >>>>>
>
> + 2002-02-03 Eli Zaretskii <eliz@is.elta.co.il>
> +
> + * term.el (term-emulate-terminal): Extract proper command string
> + which is supplied to term-command-hook.
> +
>
> --- 797,814 ----
> *************** See `term-prompt-regexp'."
> *** 2856,2864 ****
> (beep t)) ; Bell
> ((eq char ?\032)
> ! (let ((end (string-match "\n" str i)))
> (if end
> (progn (funcall term-command-hook
> ! (substring str (1+ i) (1- end)))
> ! (setq i end))
> (setq term-terminal-parameter
> (substring str i))
> --- 2831,2839 ----
> (beep t)) ; Bell
> ((eq char ?\032)
> ! (let ((end (string-match "\r?$" str i)))
> (if end
> (progn (funcall term-command-hook
> ! (substring str (1+ i) end))
> ! (setq i (match-end 0)))
> (setq term-terminal-parameter
> (substring str i))
> <<<<< End >>>>>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 15:36 ` Eli Zaretskii
@ 2002-04-13 17:25 ` Daiki Ueno
2002-04-13 18:15 ` Eli Zaretskii
2002-04-13 18:56 ` Harry Kuiper
0 siblings, 2 replies; 12+ messages in thread
From: Daiki Ueno @ 2002-04-13 17:25 UTC (permalink / raw)
Cc: hkuiper, bug-gnu-emacs
>>>>> In <8962-Sat13Apr2002183653+0300-eliz@is.elta.co.il>
>>>>> "Eli Zaretskii" <eliz@is.elta.co.il> wrote:
> > I looked at the diffs between term.el in Emacs-21.1 and Emacs-21.2
> > using these I backed out the change Eli Zaretskii made at 2002-02-03
> > (see below, something about matching terminal prompt). After that
> > term works OK again for me.
> Actually, this change was suggested by Daiki Ueno; I was asked
> (probably by Richard Stallman) to install it.
> The bug which the change was supposed to fix is explained here:
> http://mail.gnu.org/pipermail/bug-gnu-emacs/2002-January/010123.html
I guess it is the bug introduced by my patch, if the infloop is caused
by (string-match "\r?$" ""). The patch should be:
> > ! (let ((end (string-match "\r?\n" str i)))
rather than:
> > ! (let ((end (string-match "\r?$" str i)))
If this is accurate, sorry for bothering you, Eliz, please install it to
Emacs?
Regards,
--
Daiki Ueno
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 17:25 ` Daiki Ueno
@ 2002-04-13 18:15 ` Eli Zaretskii
2002-04-13 18:56 ` Harry Kuiper
1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2002-04-13 18:15 UTC (permalink / raw)
Cc: hkuiper, bug-gnu-emacs
> From: Daiki Ueno <ueno@unixuser.org>
> Date: Sun, 14 Apr 2002 02:25:44 +0900
>
> I guess it is the bug introduced by my patch, if the infloop is caused
> by (string-match "\r?$" ""). The patch should be:
>
> > > ! (let ((end (string-match "\r?\n" str i)))
>
> rather than:
>
> > > ! (let ((end (string-match "\r?$" str i)))
>
> If this is accurate, sorry for bothering you, Eliz, please install it to
> Emacs?
Thanks.
Harry, does the change above solve your problem?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 17:25 ` Daiki Ueno
2002-04-13 18:15 ` Eli Zaretskii
@ 2002-04-13 18:56 ` Harry Kuiper
2002-04-13 19:24 ` Daiki Ueno
1 sibling, 1 reply; 12+ messages in thread
From: Harry Kuiper @ 2002-04-13 18:56 UTC (permalink / raw)
Cc: Eli Zaretskii, bug-gnu-emacs
Daiki Ueno <ueno@unixuser.org> writes:
> >>>>> In <8962-Sat13Apr2002183653+0300-eliz@is.elta.co.il>
> >>>>> "Eli Zaretskii" <eliz@is.elta.co.il> wrote:
> > > I looked at the diffs between term.el in Emacs-21.1 and Emacs-21.2
> > > using these I backed out the change Eli Zaretskii made at 2002-02-03
> > > (see below, something about matching terminal prompt). After that
> > > term works OK again for me.
>
> > Actually, this change was suggested by Daiki Ueno; I was asked
> > (probably by Richard Stallman) to install it.
>
> > The bug which the change was supposed to fix is explained here:
>
> > http://mail.gnu.org/pipermail/bug-gnu-emacs/2002-January/010123.html
>
> I guess it is the bug introduced by my patch, if the infloop is caused
> by (string-match "\r?$" ""). The patch should be:
>
> > > ! (let ((end (string-match "\r?\n" str i)))
>
> rather than:
>
> > > ! (let ((end (string-match "\r?$" str i)))
>
Daiko,
Sorry but this brings back my problem again. :-(
I'm not familiar with elisp programming nor terminal emulation so I
don't really know how to help. What is the regexp supposed to match?
Greetings,
--
Harry Kuiper hkuiper@xs4all.nl
Haarlem, The Netherlands
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 18:56 ` Harry Kuiper
@ 2002-04-13 19:24 ` Daiki Ueno
2002-04-13 20:31 ` Harry Kuiper
0 siblings, 1 reply; 12+ messages in thread
From: Daiki Ueno @ 2002-04-13 19:24 UTC (permalink / raw)
Cc: Eli Zaretskii, bug-gnu-emacs
>>>>> In <87elhj2zs3.fsf@mumon.localnet>
>>>>> Harry Kuiper <hkuiper@xs4all.nl> wrote:
> Sorry but this brings back my problem again. :-(
> I'm not familiar with elisp programming nor terminal emulation so I
> don't really know how to help. What is the regexp supposed to match?
"\r?$" matches an empty string, although "\r?\n" doesn't.
Could you do M-: (setq debug-on-quit t) before entering term-mode,
type M-g, and send me the contents of the buffer named *Backtrace*?
I'll take a look at them and suppose that I can help you.
Regards,
--
Daiki Ueno
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 19:24 ` Daiki Ueno
@ 2002-04-13 20:31 ` Harry Kuiper
2002-04-13 21:54 ` Harry Kuiper
0 siblings, 1 reply; 12+ messages in thread
From: Harry Kuiper @ 2002-04-13 20:31 UTC (permalink / raw)
Cc: Eli Zaretskii, bug-gnu-emacs
Daiki Ueno <ueno@unixuser.org> writes:
>
> Could you do M-: (setq debug-on-quit t) before entering term-mode,
> type M-g, and send me the contents of the buffer named *Backtrace*?
> I'll take a look at them and suppose that I can help you.
When term hangs it is impossible to get out of it. Even typing C-g
twice does not work. I can only kill Emacs from the commandline in an
xterm. When I restart Emacs and try M-x recover-session there's a
save file alright but Emacs says there is nothing to recover from it.
Once Emacs hangs it starts to consume memory at a rate of 50 MB in 30
seconds or so.
I noticed one strange thing. The shell prompt is printed twice when I
just press enter without entering a command. The term.el version that
does not cause problems does not do this.
I tried to reproduce your original problem using the script:
#!/bin/sh
cd $HOME
exec /bin/sh "$@"
But it seems to work OK for me. No problems.
Just to make sure we are talking about the same code, below is a diff
of the broken version (term.el.broken) against my version that seems
to work (term.el):
cd /usr/local/share/emacs/21.2/lisp/
diff -u /usr/local/share/emacs/21.2/lisp/term.el.broken /usr/local/share/emacs/21.2/lisp/term.el
--- /usr/local/share/emacs/21.2/lisp/term.el.broken Sun Feb 3 12:56:52 2002
+++ /usr/local/share/emacs/21.2/lisp/term.el Sat Apr 13 14:58:06 2002
@@ -2830,11 +2830,11 @@
((eq char ?\^G)
(beep t)) ; Bell
((eq char ?\032)
- (let ((end (string-match "\r?$" str i)))
+ (let ((end (string-match "\n" str i)))
(if end
(progn (funcall term-command-hook
- (substring str (1+ i) end))
- (setq i (match-end 0)))
+ (substring str (1+ i) (1- end)))
+ (setq i end))
(setq term-terminal-parameter
(substring str i))
(setq term-terminal-state 4)
Anything else I can do to help?
--
Harry Kuiper hkuiper@xs4all.nl
Haarlem, The Netherlands
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 20:31 ` Harry Kuiper
@ 2002-04-13 21:54 ` Harry Kuiper
2002-04-13 22:31 ` Harry Kuiper
0 siblings, 1 reply; 12+ messages in thread
From: Harry Kuiper @ 2002-04-13 21:54 UTC (permalink / raw)
Cc: Eli Zaretskii, bug-gnu-emacs
Harry Kuiper <hkuiper@xs4all.nl> writes:
<snip>
>
> I noticed one strange thing. The shell prompt is printed twice when I
<snip>
Sorry I made a mistake. Not the shell prompt but the current
directory is printed when I press enter. After an elisp crash course
(long live info-mode) I understand that this should go to
term-command-hook for gud support or directory tracking instead of
onto the screen. So if I understand correctly the \032 is an
escape-code that is followed by a string that should be sent to
term-command-hook. And this did not work correctly when a ^Z was
present. Shouldn't the regexp match zero or more ^Z's followed by a
newline instead of at least one ^Z?
NB: I have the bash prompt set to display the current directory hence
the confusion.
--
Harry Kuiper hkuiper@xs4all.nl
Haarlem, The Netherlands
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 21:54 ` Harry Kuiper
@ 2002-04-13 22:31 ` Harry Kuiper
2002-04-14 1:17 ` Daiki Ueno
0 siblings, 1 reply; 12+ messages in thread
From: Harry Kuiper @ 2002-04-13 22:31 UTC (permalink / raw)
Cc: Eli Zaretskii, bug-gnu-emacs
Harry Kuiper <hkuiper@xs4all.nl> writes:
<snip>
> present. Shouldn't the regexp match zero or more ^Z's followed by a
> newline instead of at least one ^Z?
Wrong track didn't work. I misunderstood the meaning of ? in elisp
regexps.
However the version below (eterm.el.hk) works OK for me. The
difference is in the way the position to resume processing is
determined after the \032 escape is handled.
cd /usr/local/share/emacs/21.2/lisp/
diff -uw /usr/local/share/emacs/21.2/lisp/term.el.broken /usr/local/share/emacs/21.2/lisp/term.el.hk
--- /usr/local/share/emacs/21.2/lisp/term.el.broken Sun Feb 3 12:56:52 2002
+++ /usr/local/share/emacs/21.2/lisp/term.el.hk Sun Apr 14 00:11:47 2002
@@ -2830,11 +2830,11 @@
((eq char ?\^G)
(beep t)) ; Bell
((eq char ?\032)
- (let ((end (string-match "\r?$" str i)))
+ (let ((end (string-match "\r?\n" str i)))
(if end
(progn (funcall term-command-hook
(substring str (1+ i) end))
- (setq i (match-end 0)))
+ (setq i (1+ end)))
(setq term-terminal-parameter
(substring str i))
(setq term-terminal-state 4)
Diff finished at Sun Apr 14 00:25:46
~~~~~~~
Oops, time for bed now :-) ----^
--
Harry Kuiper hkuiper@xs4all.nl
Haarlem, The Netherlands
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-13 22:31 ` Harry Kuiper
@ 2002-04-14 1:17 ` Daiki Ueno
2002-04-14 6:48 ` Harry Kuiper
0 siblings, 1 reply; 12+ messages in thread
From: Daiki Ueno @ 2002-04-14 1:17 UTC (permalink / raw)
Cc: Eli Zaretskii, bug-gnu-emacs
>>>>> In <87ofgn1b8r.fsf@mumon.localnet>
>>>>> Harry Kuiper <hkuiper@xs4all.nl> wrote:
> However the version below (eterm.el.hk) works OK for me. The
> difference is in the way the position to resume processing is
> determined after the \032 escape is handled.
Your patch will work fine when there is no "\r" in str, but otherwise it
will be splitted up before "\n".
But well, I probably found the cause. The match-data tends to be lost
during executing term-command-hook. Therefore what I think the proper
fix is below:
Index: term.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/term.el,v
retrieving revision 1.46
diff -u -F^( -r1.46 term.el
--- term.el 3 Feb 2002 11:25:23 -0000 1.46
+++ term.el 14 Apr 2002 00:56:23 -0000
@@ -2827,11 +2827,11 @@ (defun term-emulate-terminal (proc str)
((eq char ?\^G)
(beep t)) ; Bell
((eq char ?\032)
- (let ((end (string-match "\r?$" str i)))
+ (let ((end (string-match "\r?\n" str i)))
(if end
- (progn (funcall term-command-hook
- (substring str (1+ i) end))
- (setq i (match-end 0)))
+ (funcall term-command-hook
+ (prog1 (substring str (1+ i) end)
+ (setq i (match-end 0))))
(setq term-terminal-parameter
(substring str i))
(setq term-terminal-state 4)
Could you please try this one?
Regards,
--
Daiki Ueno
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-14 1:17 ` Daiki Ueno
@ 2002-04-14 6:48 ` Harry Kuiper
2002-04-16 18:52 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Harry Kuiper @ 2002-04-14 6:48 UTC (permalink / raw)
Cc: Eli Zaretskii, bug-gnu-emacs
Daiki Ueno <ueno@unixuser.org> writes:
> But well, I probably found the cause. The match-data tends to be lost
> during executing term-command-hook. Therefore what I think the proper
> fix is below:
>
> Index: term.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/term.el,v
<snip>
>
> Could you please try this one?
Yes that fixed it. Works fine now.
Thanks!
--
Harry Kuiper hkuiper@xs4all.nl
Haarlem, The Netherlands
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: term.el (term-emulate-terminal)
2002-04-14 6:48 ` Harry Kuiper
@ 2002-04-16 18:52 ` Eli Zaretskii
0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2002-04-16 18:52 UTC (permalink / raw)
Cc: ueno, bug-gnu-emacs
> From: Harry Kuiper <hkuiper@xs4all.nl>
> Date: 14 Apr 2002 08:48:24 +0200
>
> Daiki Ueno <ueno@unixuser.org> writes:
>
> > But well, I probably found the cause. The match-data tends to be lost
> > during executing term-command-hook. Therefore what I think the proper
> > fix is below:
> >
> > Index: term.el
> > ===================================================================
> > RCS file: /cvsroot/emacs/emacs/lisp/term.el,v
> <snip>
> >
> > Could you please try this one?
>
> Yes that fixed it. Works fine now.
Thanks to both of you for working on this. I made this change in the
development tree.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2002-04-16 18:52 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-13 13:40 term.el (term-emulate-terminal) Harry Kuiper
2002-04-13 15:36 ` Eli Zaretskii
2002-04-13 17:25 ` Daiki Ueno
2002-04-13 18:15 ` Eli Zaretskii
2002-04-13 18:56 ` Harry Kuiper
2002-04-13 19:24 ` Daiki Ueno
2002-04-13 20:31 ` Harry Kuiper
2002-04-13 21:54 ` Harry Kuiper
2002-04-13 22:31 ` Harry Kuiper
2002-04-14 1:17 ` Daiki Ueno
2002-04-14 6:48 ` Harry Kuiper
2002-04-16 18:52 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).