From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ioannis Kappas Newsgroups: gmane.emacs.bugs Subject: bug#53808: 29.0.50; ansi colorization process could block indefinetly on stray ESC char Date: Sat, 5 Feb 2022 20:52:25 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40406"; mail-complaints-to="usenet@ciao.gmane.io" To: 53808@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 05 21:53:45 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nGS41-000AOh-2U for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Feb 2022 21:53:45 +0100 Original-Received: from localhost ([::1]:38614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGS3z-0007wq-Hp for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Feb 2022 15:53:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGS3d-0007we-T1 for bug-gnu-emacs@gnu.org; Sat, 05 Feb 2022 15:53:21 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGS3K-0006qn-Md for bug-gnu-emacs@gnu.org; Sat, 05 Feb 2022 15:53:20 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nGS3K-0007Nd-Dx for bug-gnu-emacs@gnu.org; Sat, 05 Feb 2022 15:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ioannis Kappas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Feb 2022 20:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53808 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164409437228346 (code B ref -1); Sat, 05 Feb 2022 20:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Feb 2022 20:52:52 +0000 Original-Received: from localhost ([127.0.0.1]:35676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGS3A-0007N8-1G for submit@debbugs.gnu.org; Sat, 05 Feb 2022 15:52:52 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGS37-0007Mz-Sp for submit@debbugs.gnu.org; Sat, 05 Feb 2022 15:52:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGS37-0007uk-1A for bug-gnu-emacs@gnu.org; Sat, 05 Feb 2022 15:52:49 -0500 Original-Received: from [2607:f8b0:4864:20::234] (port=36416 helo=mail-oi1-x234.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGS34-0006pC-S5 for bug-gnu-emacs@gnu.org; Sat, 05 Feb 2022 15:52:48 -0500 Original-Received: by mail-oi1-x234.google.com with SMTP id s185so12828012oie.3 for ; Sat, 05 Feb 2022 12:52:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=ObvYVpN8WncJIHUqYCoL3qayqJueQperKQxSDDcNOMk=; b=WsD5bwGNZZ/ouaKoIHIWjBUGcaLuQUc2g2fMpWV6BUFT6Mzn0GD5RF0tTv84jEpNe5 x/c69FyYfkq3ktviUj6kFWbvrI2HRwpaGG6WG4oKtbX+Jph2RInoxKlDroYE25AbaPiR Vgkd3koH4WTdQjfoilWND7cyHvBwM/yah1ZGnLCLWsYr/UK6ySxCj20BSMGsQVVtHpO1 EoCPh5Sxc/PTpu7t6uBmODF6KMP9hB20myEXEsqltgyEVIW7wnWfch7JjgT/VSfui2ms /iBx5sbaI5fBqeTsdPTqkWx4iXJQLYmm4HWKyljzRJHBx1KgNYkqG2p1pA3NNzjzueB3 y6Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ObvYVpN8WncJIHUqYCoL3qayqJueQperKQxSDDcNOMk=; b=zgjwK7O5tMmyx1HrlybKxkqznSe37RsRDr4b6jmCkk3Dg1BzyLPOT+8+HSvaNMrEps IVLmVGgjj92R2yldhxDotdfRuKwhynJ2cXe55jTGWOHjOW5W+qKl+7z2X+OAlJkSMFNt glVPMOO1SkoMCKZ9P5HXLiV/khjRqZTyZzPq5qiZ8KeVetiNen0ZDYF1+i2I1VWYPZSI as5sLmevcsR+VdhDvMAU5hsF1ua4rtwnIYgSRCDVTQ7ikVcVsG0MOUfA9QV0Q1Sr2/Je LB+jYVJ3Q8kt0hC5f7GOeZhcdRkQdAO9Q9t/nC0Sy8orO5CeuvWx0R0bUHZ9yPd7nU1/ yJ4Q== X-Gm-Message-State: AOAM532AlnUACTRXdnPEqDBgIIeH9M5k7Y2h6WvgylheF5+9HyMVFekj pdT8H01Oy7SqFgPZ+nH1pygef2aNIcDECHHX4bTGLYft/Ew= X-Google-Smtp-Source: ABdhPJw14hsEbxMrVNQTjq+fol3NUK25NjAfOQkMSFeh9m4FkQkXIre7J5aX0/9jGrfcDK9tAu+LH/qRT/tpGyYx8i4= X-Received: by 2002:a05:6808:2228:: with SMTP id bd40mr2340992oib.335.1644094355820; Sat, 05 Feb 2022 12:52:35 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::234 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=ioannis.kappas@gmail.com; helo=mail-oi1-x234.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226091 Archived-At: 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