all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#44156: 26.3; ERC: Fix ERC's IBuffer format "crash" on killed server buffer
@ 2020-10-22 21:50 Olivier Certner
  2020-10-23 12:40 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier Certner @ 2020-10-22 21:50 UTC (permalink / raw)
  To: 44156

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

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

[-- Attachment #2: 0001-ERC-Fix-ERC-s-IBuffer-format-crash-on-killed-server-.patch --]
[-- Type: text/x-patch, Size: 2430 bytes --]

From e10325a729d39b32dcf83de17a7f19e5152ec496 Mon Sep 17 00:00:00 2001
From: Olivier Certner <ocert.dev@free.fr>
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  <ocert.dev@free.fr>
+
+	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  <psainty@orcon.net.nz>
 
 	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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-23 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-22 21:50 bug#44156: 26.3; ERC: Fix ERC's IBuffer format "crash" on killed server buffer Olivier Certner
2020-10-23 12:40 ` Lars Ingebrigtsen
2020-10-23 13:00   ` Olivier Certner
2020-10-23 13:12     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.