From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Olivier Certner Newsgroups: gmane.emacs.bugs Subject: bug#44156: 26.3; ERC: Fix ERC's IBuffer format "crash" on killed server buffer Date: Thu, 22 Oct 2020 23:50:27 +0200 Message-ID: <1823357.Ei5Gdb227I@ravel> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart47182727.lso2nkH8hQ" Content-Transfer-Encoding: 7Bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17558"; mail-complaints-to="usenet@ciao.gmane.io" To: 44156@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 22 23:51:17 2020 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 1kViUN-0004Q7-04 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Oct 2020 23:51:15 +0200 Original-Received: from localhost ([::1]:34102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kViUL-0005z7-GK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Oct 2020 17:51:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kViUA-0005ya-MU for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 17:51:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kViUA-0003FQ-CP for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 17:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kViUA-0004hz-8a for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 17:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Olivier Certner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Oct 2020 21:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44156 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.160340343718064 (code B ref -1); Thu, 22 Oct 2020 21:51:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Oct 2020 21:50:37 +0000 Original-Received: from localhost ([127.0.0.1]:54119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kViTl-0004hI-HZ for submit@debbugs.gnu.org; Thu, 22 Oct 2020 17:50:37 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:51094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kViTi-0004h9-W3 for submit@debbugs.gnu.org; Thu, 22 Oct 2020 17:50:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kViTi-0005ux-Nz for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 17:50:34 -0400 Original-Received: from smtp3-g21.free.fr ([2a01:e0c:1:1599::12]:25730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kViTg-00039I-M7 for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 17:50:34 -0400 Original-Received: from ravel.localnet (unknown [90.8.148.191]) (Authenticated sender: ocert.dev@free.fr) by smtp3-g21.free.fr (Postfix) with ESMTPSA id 8B8E413F85F for ; Thu, 22 Oct 2020 23:50:27 +0200 (CEST) Received-SPF: none client-ip=2a01:e0c:1:1599::12; envelope-from=ocert.dev@free.fr; helo=smtp3-g21.free.fr X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, SPOOFED_FREEMAIL=1.999 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:191319 Archived-At: This is a multi-part message in MIME format. --nextPart47182727.lso2nkH8hQ Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Applies to 26.3, but also to all more recent versions as well. Bug trigger: 1. Load ERC (e.g., open some IRC connection). 2. Open some channel or query, to have another ERC buffer. 3. Quit the server. 4. Make sure to kill the server buffer, if still there. 5. Launch ibuffer (e.g., type "M-x ibuffer"). Display stops mid-line on a line listing some ERC buffer linked to the quit server. Further buffer updates (typing 'g') trigger a crash for another reason (another fix to follow-up). Root cause: The erc-ibuffer's server column code will return nil in this case, since the buffer associated to its process has been killed, making the server information inacessible, and this is not tested properly. Patch: Attached. -- Olivier Certner --nextPart47182727.lso2nkH8hQ Content-Disposition: attachment; filename="0001-ERC-Fix-ERC-s-IBuffer-format-crash-on-killed-server-.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-ERC-Fix-ERC-s-IBuffer-format-crash-on-killed-server-.patch" >From e10325a729d39b32dcf83de17a7f19e5152ec496 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 22 Oct 2020 23:14:22 +0200 Subject: [PATCH] ERC: Fix ERC's IBuffer format "crash" on killed server buffer * lisp/erc/erc-ibuffer.el (erc-server-name): Fix a crash when displaying (or updating) an IBuffer buffer using ERC's first IBuffer format. This happens when one ERC buffer has its associated server buffer killed, e.g., voluntarily or automatically after server disconnection when `erc-kill-server-buffer-on-quit' is set to t. The culprit is the "Server" column, which returns nil in this case. Display "(closed)" instead. --- ChangeLog.3 | 13 +++++++++++++ lisp/erc/erc-ibuffer.el | 12 ++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog.3 b/ChangeLog.3 index ec2d3f8d46..65c846a307 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -1,3 +1,16 @@ +2020-10-22 Olivier Certner + + ERC: Fix ERC's IBuffer format "crash" on killed server buffer + + * lisp/erc/erc-ibuffer.el (erc-server-name): Fix a crash when + displaying (or updating) an IBuffer buffer using ERC's first + IBuffer format. This happens when one ERC buffer has its + associated server buffer killed, e.g., voluntarily or + automatically after server disconnection when + `erc-kill-server-buffer-on-quit' is set to t. The culprit is the + "Server" column, which returns nil in this case. Display + "(closed)" instead. + 2020-08-03 Phil Sainty lisp/so-long.el: Improve support for major mode hooks diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el index 7aee7705ff..556a25e3e7 100644 --- a/lisp/erc/erc-ibuffer.el +++ b/lisp/erc/erc-ibuffer.el @@ -92,10 +92,14 @@ " ")) (define-ibuffer-column erc-server-name (:name "Server") - (if (and erc-server-process (processp erc-server-process)) - (with-current-buffer (process-buffer erc-server-process) - (or erc-server-announced-name erc-session-server)) - "")) + (or + (when (and erc-server-process (processp erc-server-process)) + (let ((buffer (process-buffer erc-server-process))) + (if (buffer-live-p buffer) + (with-current-buffer buffer + (or erc-server-announced-name erc-session-server)) + "(closed)"))) + "")) (define-ibuffer-column erc-target (:name "Target") (if (eq major-mode 'erc-mode) -- 2.24.1 --nextPart47182727.lso2nkH8hQ--