GNU bug report logs -
#24189
25.1.50; args-out-of-range in ansi-color-filter-apply
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24189 in the body.
You can then email your comments to 24189 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24189
; Package
emacs
.
(Mon, 08 Aug 2016 19:24:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Aaron Ecay <aaronecay <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 08 Aug 2016 19:24:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
With recent master emacs, I get an error under the following conditions:
0. Install ipython
1. emacs -Q
2. Eval in scratch buffer: (setq python-shell-interpreter "ipython")
3. C-x C-f foo.py
4. C-c C-p
The backtrace is:
-----cut here-----
Debugger entered--Lisp error: (args-out-of-range "Python 3.5.2 (default, Jun 28 2016, 08:46:01)
Type \"copyright\", \"credits\" or \"license\" for more information.
IPython 5.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[6n[0m[0m[J[J[0m[6n" 423)
string-match("" "Python 3.5.2 (default, Jun 28 2016, 08:46:01) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.0.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[6n[0m[0m[J[J[0m[6n" 423)
ansi-color-filter-apply("Python 3.5.2 (default, Jun 28 2016, 08:46:01) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.0.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m[0m[J[?12l[?25h[J[0m[?2004l[6n")
python-shell-comint-watch-for-first-prompt-output-filter("Python 3.5.2 (default, Jun 28 2016, 08:46:01) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.0.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m[0m[J[?12l[?25h[J[0m[?2004l[6n")
run-hook-with-args(python-shell-comint-watch-for-first-prompt-output-filter "Python 3.5.2 (default, Jun 28 2016, 08:46:01) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.0.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m[0m[J[?12l[?25h[J[0m[?2004l[6n")
comint-output-filter(#<process Python> "Python 3.5.2 (default, Jun 28 2016, 08:46:01) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.0.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m[0m[J[?12l[?25h[J[0m[?2004l[6n")
-----cut here-----
The relevant code is:
(defun ansi-color-filter-apply (string)
"Filter out all ANSI control sequences from STRING.
Every call to this function will set and use the buffer-local variable
`ansi-color-context' to save partial escape sequences. This information
will be used for the next call to `ansi-color-apply'. Set
`ansi-color-context' to nil if you don't want this.
This function can be added to `comint-preoutput-filter-functions'."
(let ((start 0) end result)
;; if context was saved and is a string, prepend it
(if (cadr ansi-color-context)
(setq string (concat (cadr ansi-color-context) string)
ansi-color-context nil))
;; find the next escape sequence
(while (setq end (string-match ansi-color-regexp string start))
(setq result (concat result (substring string start end))
start (match-end 0)))
;; eliminate unrecognized escape sequences
(while (string-match ansi-color-drop-regexp string)
(setq string
(replace-match "" nil nil string)))
;; save context, add the remainder of the string to the result
(let (fragment)
(if (string-match "\033" string start) ;; <---- ?!?!?!?
(let ((pos (match-beginning 0)))
(setq fragment (substring string pos)
result (concat result (substring string start pos))))
(setq result (concat result (substring string start))))
(setq ansi-color-context (if fragment (list nil fragment))))
result))
It looks obviously bogus: the value of start is computed in the first
while, but the second while (potentially) makes deletions in the string.
After the second while, the value of start is reused (on the line I
marked with a comment), when it could be (and in this case is) beyond
the end of the string because of the deletions. I don’t understand the
code well enough to know what the proper fix is. I tried moving the
“eliminate unrecognized escape sequences” while to before the “find the
next escape sequence” one. That made the error disappear, but did not
successfully display ANSI colors in the buffer (but rather left many
escape sequences in raw form behind).
Thanks,
Aaron
In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.8)
of 2016-08-08 built on haize
Repository revision: 9fc22fb932599fe4fecffffa920abe509ab5cbb0
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Arch Linux
Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --mandir=/usr/share/man
--pdfdir=/usr/share/doc/emacs/pdf --with-sound=alsa --without-gconf
--with-x-toolkit=gtk3 --with-xft 'CFLAGS=-march=x86-64 -mtune=generic
-O2 -pipe -fstack-protector --param=ssp-buffer-size=4'
CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
--
Aaron Ecay
Merged 24189 24223.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Sun, 14 Aug 2016 11:12:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24189
; Package
emacs
.
(Fri, 02 Sep 2016 17:01:02 GMT)
Full text and
rfc822 format available.
Message #10 received at submit <at> debbugs.gnu.org (full text, mbox):
> With recent master emacs, I get an error under the following conditions:
>
> 0. Install ipython
> 1. emacs -Q
> 2. Eval in scratch buffer: (setq python-shell-interpreter "ipython")
> 3. C-x C-f foo.py
> 4. C-c C-p
It turns out this is due to the new terminal interface of ipython. You
can fix the behavior by adding --simple-prompt to your
python-shell-interpreter-args. (See
https://emacs.stackexchange.com/questions/24453/weird-shell-output-when-using-ipython-5
for details)
Cheers,
Kwang
bug No longer marked as found in versions 24.5.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 11 Jan 2017 18:21:02 GMT)
Full text and
rfc822 format available.
Added indication that bug 24189 blocks24655
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 11 Jan 2017 18:24:02 GMT)
Full text and
rfc822 format available.
Added indication that bug 24189 blocks21966
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 12 Jan 2017 16:45:01 GMT)
Full text and
rfc822 format available.
Added tag(s) fixed.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Mon, 03 Jul 2017 14:11:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.1, send any further explanations to
24223 <at> debbugs.gnu.org and Ivan Andrus <darthandrus <at> gmail.com>
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Mon, 03 Jul 2017 14:11:03 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
.
(Tue, 01 Aug 2017 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 324 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.