GNU bug report logs -
#53808
29.0.50; ansi colorization process could block indefinetly on stray ESC char
Previous Next
Reported by: Ioannis Kappas <ioannis.kappas <at> gmail.com>
Date: Sat, 5 Feb 2022 20:53:02 UTC
Severity: normal
Found in version 29.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
there appears to be an issue with `ansi-color-apply' that a stray ESC
control character in the input string can block the colorization process
(with-temp-buffer (ansi-color-apply "a\ebc"))
;; => "a"
(with-temp-buffer (concat (ansi-color-apply "a\ebc") (ansi-color-apply "xyz")))
;; => "a"
The process is blocked at character a the rest are never printed. It
can only resume when a CSI
seq (i.e. one starting with ESC [) appears in the stream
(with-temp-buffer (concat (ansi-color-apply "ab\ec") (ansi-color-apply
"x\e[yz")))
;; => "ab^[cxz"
or, using a valid SGR as an example
(with-temp-buffer (concat (ansi-color-apply "ab\ec") (ansi-color-apply
"x\e[3myz")))
;; => #("ab^[cxyz" 5 7
;; (font-lock-face italic))
This behavior can pose serious problems to applications which support
ansi colorisation of their output streams, but otherwise treat ESC as
any other control character (e.g. REPLs colorizing their output with
ansi-color but they also like to display any other character). Their
output might be blocked indefinitely when an ESC character appears in
their output.
My expectation is that a character sequence starting with ESC which is
not being part of an SGR sequence, should be output immediately,
rather than treated as a potential SGR sequence (which by definition
it can never be) blocking further processing.
e.g.
(with-temp-buffer (ansi-color-apply "a\ebc"))
;; => "a^[bc"
Analysis to follow.
Thanks
In GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32)
Repository revision: 3a8e140ad115633791d057bd10998d80c33e6dc7
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10
This bug report was last modified 3 years and 106 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.