From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Morgan Smith Newsgroups: gmane.emacs.bugs Subject: bug#45380: 28.0.50; Error in coloured output in Emacs 28.05(AUR package: emacs-git) Date: Sun, 24 Oct 2021 20:44:24 -0400 Message-ID: References: <87o8il9n8q.fsf@gmail.com> <87zh0zqmhd.fsf@gnus.org> <877do2n3ux.fsf@gmail.com> <87y2ggoa22.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26697"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Utkarsh Singh , 45380@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 25 02:45:59 2021 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 1meo7h-0006kU-OR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Oct 2021 02:45:58 +0200 Original-Received: from localhost ([::1]:47832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meo7g-0002yI-MK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 20:45:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meo6p-0002wf-5D for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 20:45:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meo6o-0007Jb-GC for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 20:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1meo6o-0008Rt-9N for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 20:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Morgan Smith Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Oct 2021 00:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45380 X-GNU-PR-Package: emacs Original-Received: via spool by 45380-submit@debbugs.gnu.org id=B45380.163512269632451 (code B ref 45380); Mon, 25 Oct 2021 00:45:02 +0000 Original-Received: (at 45380) by debbugs.gnu.org; 25 Oct 2021 00:44:56 +0000 Original-Received: from localhost ([127.0.0.1]:41300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meo6h-0008RL-L5 for submit@debbugs.gnu.org; Sun, 24 Oct 2021 20:44:55 -0400 Original-Received: from mail-dm6nam12olkn2107.outbound.protection.outlook.com ([40.92.22.107]:64512 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meo6f-0008R6-GN for 45380@debbugs.gnu.org; Sun, 24 Oct 2021 20:44:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ixx3jUfEYFpAAPzhvBeg8+tdCkznA3qA0EGqeojlFGvX/drTGxKNqIcL8KzcMPe68xhKJu4AAqQSAP79tatzh0ONVpcQd37/7CqkJYPOjSbc7OS3ao88EmKh87KVUuzb9J4khL18RsqsfCmJRWHm0FuZOkRxtt553Rw7NJ1MZpUQblI/nKnhqgxO9SH1aH9hx4t7kLyj1H+llpXWs4qnXsn3LXhhuh8WJD/yv/V7zvhvibCtbP1h1Thuq7RrHV+VNie5taxhxDjTR7nSwpLJ7kCxEAcrBYPu7ymRCCMPMfSmD4SPyh/Oj8wuS1VUOpwy1K3lcJxJLhep+Q0UMDIzhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VuIy8VD4Uxv8zLGpT8dk4bXXFBE+ij1aUPC0WAD0QDw=; b=N6n58RyAU/DDI5KhMEYkXdcVh6dW9QvyIf8DVqr8xrIvL8ukUIoen3cSZMPhkfmCqdK7S1uK6wVSrZMjA9o+G7x33x28tDdzjrHYdC1Uw77Zk49LQooQ7Ul/au4WlQQTVY4ImvZg/HQA7xSeeEbpNDTJHi3nxMlzvP4T/71yv1WLYm3euOCEB0Klgy7+gp3MmHbI5lzwF7RMn52LAMGk8zS6/l+krmn6SOhflTta+/rR1B7ilQzS8FqfZiqSMQngDWO7flcPk6Ks65kgCr2pzwsL+7sGUzpK6jIbziC6Yw1zHMLVbx3QJ1o7ABPH7lShEX2LRuRf1jqbWiA/oMnX3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VuIy8VD4Uxv8zLGpT8dk4bXXFBE+ij1aUPC0WAD0QDw=; b=mSt9nosWCncd82gzYVYRaugvJ0Eveyv9LH1R8OdpPz3n+HBJW5usFWr8ukqiIrjeFkmUlyu2z7AmBWPh92L9rzpxpYwQLst6ImmTUOUwOt8ApC8/CSp6VNH8P8OrpnzxNyqrsdfOThmDy4kVd4yGSdazsD+rXFUjEMttgSom7Oou2eWW1j8vAx3PXr/Pzf+9Ld+U6921rRyhSjJ7bNNRa9M4eDw8IbuJGCHclgwK4ui/g5+4mo1q48lkVXmYRQqIp63HuSJlFK+4CZkQ3bLvMHDSsbN2rxQUjwsz2xkeeb1QVJqXN5nJFS+gJ5X/Ep+dXUnwhywWXCVfAddEhVl2qQ== Original-Received: from BYAPR05MB4023.namprd05.prod.outlook.com (2603:10b6:a02:87::30) by BY3PR05MB8545.namprd05.prod.outlook.com (2603:10b6:a03:3cc::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.12; Mon, 25 Oct 2021 00:44:46 +0000 Original-Received: from BYAPR05MB4023.namprd05.prod.outlook.com ([fe80::745d:ce8d:67ec:5154]) by BYAPR05MB4023.namprd05.prod.outlook.com ([fe80::745d:ce8d:67ec:5154%6]) with mapi id 15.20.4649.013; Mon, 25 Oct 2021 00:44:46 +0000 In-Reply-To: <87y2ggoa22.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 26 Jan 2021 00:45:25 +0100") X-TMN: [vs8yilkifYj9cHtdkL1xwuBdFVjffy0t] X-ClientProxiedBy: YQBPR01CA0137.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:1::37) To BYAPR05MB4023.namprd05.prod.outlook.com (2603:10b6:a02:87::30) X-Microsoft-Original-Message-ID: <87sfwq2as7.fsf@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from workpad (170.52.80.188) by YQBPR01CA0137.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:1::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 00:44:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98786287-4998-4c2d-62b8-08d99750a43b X-MS-TrafficTypeDiagnostic: BY3PR05MB8545: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9AyDyL2C4IYDRIgouCM46vVZINFEjtQ+EBAsbDovRjscon1CQEuMY5oZm1C8tN7G/oV0Xw1ZJLg8s+gI7x79ZWbE5SFYb2bLpy5SuYn/eTYMUseOyuz1cmJ8RvwpzfQZSVFO3mXxgdj5gEh1s42CWNvoVB8UQNX5xVFnYIIPLRkxqe730wrlFCXr1aVYhVmAyU4sK3VdvLt0Q6/Xbu3g+S1b0FTnt2BWbVrlKBBfwZS6JdJt16HJwX8ntgLHEvqMYwOHa3KMP9LlIR3J/T+E74Vr+UL4CQd8/i1ZDwKKC3jZ2ckW9580TPj1iW36sgOJgSt9wkYmL53OOapQ+92599qotExYQ3QWaxtwC9rl4HCaJTV9fm7x/1sLp2y7ayvKAiyzz9FcpurLuIj9f2nao77TxEue/dMDrdB65tSJXIkx1ZwJFeVlLP3DdjbUM5Zlwx0MWSlLIUIjR4eh5ckGTQPea1JAL7hZISDhedkJQbOZ405UX0+qlBN2S0DmNUoDOz9dGCDVce0S/9P/obgDxcl9ZX2Ikv7ws9wV0l6NHGE= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PpmvQJGPRrhYIC8A67iLfC1TNmStzfv+xVdLUwj3GiylwVUG+VQ2AvVliXaHar/ks+A1polfNS8zxiPJz97kc0XquuNXfKT01u8iYdXeqKo3cmyyiW36dnwgPuO6BuMHqNYr2px1jPC/F+pYwG7B1GX0keiMYKX8GJwpfieLDL7/nRTyvVSKfRTkbv+elc9qT26Z9iy3XQ9oSg3xnN039Bs4Ygevi6S9BBnnit9YBHyTNfWzgty8ubBTV3EzsmxCjV5mT22RdGg+Sf5vLBnHSaMFqkeW5T9wSWisn9Fz/dg/HGMJ/NW2Tmn3B54vDAtF68yGTSnufUIs28kIW8/DSdCV8hRoVntiu7GyoBkc8eD/3eEtRjTQ4zrlxcmgSP2uCLnQPEmcaZe4kEUzUu3RM/5L4FaS6i4wEMFnTqKe1Eb+fNQ8FTZzLHolILyxe61lemFRXjEljisEHqn5oPf0S+vULITOs/aRcSJKhEeU0GlKMyicoShyAX7nmIcWREnzZ5wiwdKb2JK9Ibo+xqkZERODhS/sOQtFc0YTbpFj1j4MufrGxpfHceROCac+0QHlEXjZMMZzLTWsQFl3oBdBrUeCelVBnfOH9LVcVHD2zJAYyig9BcQ/xe27LfOQlU9lGd09pT/KFZ3jYLvS2t+pWggGF4okHniOZ8REeJK+KQZX45JJlPxu+xy8pO/Y2baPzYLnlO/ZuU0Qb7yUBINJ9w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98786287-4998-4c2d-62b8-08d99750a43b X-MS-Exchange-CrossTenant-AuthSource: BYAPR05MB4023.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 00:44:46.3585 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR05MB8545 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:218238 Archived-At: Hey all, I spent a good chunk of time debugging this but I'm pretty new to emacs devel so please let me know if I say anything funny. How to reproduce: Just keep trying some long running colored commands in eshell like "git log --color". Eventually the logic will get messed up and it'll look like the previously posted screenshot. I've seen this bugs hundred of times from all sorts of different external commands. As long as the command has enough output it's not a question of "if" but "when" will the bug show. I think the issue is in eshell-output-filter. Specifically I think the issue is with how it sets the eshell-last-output-start and eshell-last-input-end markers. If we add some advice around our coloring function we can see that the coloring regions "overlap". I assume this overlap is because coloring the region is removing the control characters and making the region smaller. I don't think this is actually an issue, it's just something that smells like it could create bugs. ;; How to see the marker values (defun where-are-markers (marker1 marker2) (message "%s and %s" marker1 marker2)) (advice-add 'ansi-color-apply-on-region :before 'where-are-markers) Thankfully, we can test out what would happen if we colored each bit of output as it comes in without worrying about regions. All we have to do is run this first: (delete 'eshell-handle-ansi-color eshell-output-filter-functions) (add-to-list 'eshell-preoutput-filter-functions 'ansi-color-apply) And voila! Problem gone! Also I feel like this might run faster then the current method of filtering but I might be wrong about that. So in conclusion: I found a workaround that might be more performant then the current coloring method but also doesn't actually fix the bug so we should probably dig deeper. Morgan