From unknown Mon Aug 18 03:03:26 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#30639 <30639@debbugs.gnu.org> To: bug#30639 <30639@debbugs.gnu.org> Subject: Status: 25.1; ERC buffer name not unique, broken on reconnect [patch] Reply-To: bug#30639 <30639@debbugs.gnu.org> Date: Mon, 18 Aug 2025 10:03:26 +0000 retitle 30639 25.1; ERC buffer name not unique, broken on reconnect [patch] reassign 30639 emacs submitter 30639 John Goerzen severity 30639 minor tag 30639 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 27 17:33:07 2018 Received: (at submit) by debbugs.gnu.org; 27 Feb 2018 22:33:07 +0000 Received: from localhost ([127.0.0.1]:36127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqno2-0004S7-LI for submit@debbugs.gnu.org; Tue, 27 Feb 2018 17:33:06 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50557) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqnNN-0003nq-Qm for submit@debbugs.gnu.org; Tue, 27 Feb 2018 17:05:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqnNG-00008S-TE for submit@debbugs.gnu.org; Tue, 27 Feb 2018 17:05:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqnNG-00008M-Qf for submit@debbugs.gnu.org; Tue, 27 Feb 2018 17:05:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqnNF-0001Us-Aq for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 17:05:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqnNA-0008UN-R1 for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 17:05:25 -0500 Received: from glockenspiel.complete.org ([142.4.200.132]:47694) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqnNA-0008Ts-Ky for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 17:05:20 -0500 Received: by glockenspiel.complete.org with esmtps (with TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (TLS peer CN christoph.complete.org, certificate verified) (Exim 4.89) (envelope-from ) id 1eqnN7-000336-S7 for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 16:05:17 -0600 Received: from jgoerzen by athena with local (Exim 4.89) (envelope-from ) id 1eqnN5-0006Zm-2g for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 16:05:15 -0600 User-agent: mu4e 0.9.18; emacs 25.1.1 From: John Goerzen To: bug-gnu-emacs@gnu.org Subject: 25.1; ERC buffer name not unique, broken on reconnect [patch] Date: Tue, 27 Feb 2018 15:15:30 -0600 Message-ID: <877eqyrv80.fsf@complete.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 27 Feb 2018 17:33:05 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) Hi, Over at https://www.emacswiki.org/emacs/ErcBugs, there is a description as follows: "When you're in two channels with the same name, e.g. #hello, on different networks, the buffers are called #hello and #hello<2>. Now, if you temporarily lose your connection (e.g. unplug the network cable and plug it back in) and ERC reconnects, #hello<2> will not be re-used, but instead #hello<3> will be created." I have observed this. This all goes back to a bug in erc/erc.el:erc-generate-new-buffer-name The comments in the function as given are reasonable, but the logic differs. In particular, the test in the dolist always fails when (get-buffer candidate) is nil; that is, the test always fails when the buffer does not already exist. This causes the test to drop through to the section at the bottom every time, which results not only in the server appending logic never being used, but also in the concatenation of /server never being attempted. Here is a working replacement: (defun erc-generate-new-buffer-name (server port target) "Create a new buffer name based on the arguments." (when (numberp port) (setq port (number-to-string port))) (let ((buf-name (or target (or (let ((name (concat server ":" port))) (when (> (length name) 1) name)) ;; This fallback should in fact never happen "*erc-server-buffer*"))) buffer-name) ;; Reuse existing buffers, but not if the buffer is a connected server ;; buffer and not if its associated with a different server than the ;; current ERC buffer. ;; if buf-name is taken by a different connection (or by something !erc) ;; then see if "buf-name/server" meets the same criteria (dolist (candidate (list buf-name (concat buf-name "/" server))) (if (and (not buffer-name) erc-reuse-buffers (or (not (get-buffer candidate)) (or target (with-current-buffer (get-buffer candidate) (and (erc-server-buffer-p) (not (erc-server-process-alive))))) (with-current-buffer (get-buffer candidate) (and (string= erc-session-server server) (erc-port-equal erc-session-port port))))) (setq buffer-name candidate))) ;; if buffer-name is unset, neither candidate worked out for us, ;; fallback to the old uniquification method: (or buffer-name (generate-new-buffer-name (concat buf-name "/" server))) )) In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian built on trouble Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 System Description: Debian GNU/Linux 9.3 (stretch) Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs25-wN2qS3/emacs25-25.1+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LANG: en_US.utf8 locale-coding-system: utf-8-unix Major mode: mu4e:main From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 14 14:11:29 2018 Received: (at 30639) by debbugs.gnu.org; 14 Apr 2018 18:11:29 +0000 Received: from localhost ([127.0.0.1]:52579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f7Pe4-00050y-UZ for submit@debbugs.gnu.org; Sat, 14 Apr 2018 14:11:29 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:55653) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f7Pe2-00050g-0o for 30639@debbugs.gnu.org; Sat, 14 Apr 2018 14:11:26 -0400 Received: from 46.67.12.60.tmi.telenormobil.no ([46.67.12.60] helo=corrigan) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1f7Pdx-0005Fx-It; Sat, 14 Apr 2018 20:11:23 +0200 Received: from larsi by corrigan with local (Exim 4.89) (envelope-from ) id 1f7Pdr-0006jo-NQ; Sat, 14 Apr 2018 20:11:15 +0200 From: Lars Ingebrigtsen To: John Goerzen Subject: Re: bug#30639: 25.1; ERC buffer name not unique, broken on reconnect [patch] References: <877eqyrv80.fsf@complete.org> Date: Sat, 14 Apr 2018 20:11:15 +0200 In-Reply-To: <877eqyrv80.fsf@complete.org> (John Goerzen's message of "Tue, 27 Feb 2018 15:15:30 -0600") Message-ID: <87k1t94q0s.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 30639 Cc: 30639@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) John Goerzen writes: > The comments in the function as given are reasonable, but the logic > differs. In particular, the test in the dolist always fails when > (get-buffer candidate) is nil; that is, the test always fails when the > buffer does not already exist. This causes the test to drop through to > the section at the bottom every time, which results not only in the > server appending logic never being used, but also in the concatenation > of /server never being attempted. > > Here is a working replacement: Thanks; applied to Emacs 27.1. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 14 14:11:28 2018 Received: (at control) by debbugs.gnu.org; 14 Apr 2018 18:11:29 +0000 Received: from localhost ([127.0.0.1]:52577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f7Pe4-00050w-Nq for submit@debbugs.gnu.org; Sat, 14 Apr 2018 14:11:28 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:55656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f7Pe2-00050i-0z for control@debbugs.gnu.org; Sat, 14 Apr 2018 14:11:26 -0400 Received: from 46.67.12.60.tmi.telenormobil.no ([46.67.12.60] helo=corrigan) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1f7Pdz-0005Ox-Ik for control@debbugs.gnu.org; Sat, 14 Apr 2018 20:11:25 +0200 Received: from larsi by corrigan with local (Exim 4.89) (envelope-from ) id 1f7Pdt-0006js-PN for control@debbugs.gnu.org; Sat, 14 Apr 2018 20:11:17 +0200 To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #30639 Message-Id: Date: Sat, 14 Apr 2018 20:11:17 +0200 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 30639 fixed close 30639 From unknown Mon Aug 18 03:03:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 13 May 2018 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 07:10:24 2020 Received: (at control) by debbugs.gnu.org; 24 Jun 2020 11:10:25 +0000 Received: from localhost ([127.0.0.1]:37857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jo3IO-0003ke-Np for submit@debbugs.gnu.org; Wed, 24 Jun 2020 07:10:24 -0400 Received: from wforward2-smtp.messagingengine.com ([64.147.123.31]:56043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jo3IN-0003kP-0G for control@debbugs.gnu.org; Wed, 24 Jun 2020 07:10:23 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailforward.west.internal (Postfix) with ESMTP id 1BC6BB97; Wed, 24 Jun 2020 07:10:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 24 Jun 2020 07:10:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=pHXmavb7tEPHllulR4Wb8v/pdoy9Vebi1HqnBVxq7 xI=; b=LJ80ZVe/EGT2Lm/oIz83KjSQgwzPOidvq/b51fISONW864lJGQITD/tvz jlPYbNaTmC+eQIzyo1mLwOjwFL3oSKvzpG3h7sRtCEc06eg2cJUHmWhEEu/hvG2j Fkx9D74fQ6xU5cHS/9v473LX6qfWwrnyAEtdY04xgYeOn9pf7mQBVzGzSlgb7OWj qEgDQSS/WbhUYf3XC0YmZOTcYNfNhq+AmMsm4acLzXC+l0dGynTceYaXDXO/DoLV doXoANBnH1LVkc1y2IKq142MGXK4gnunMDn3FX06aDqWny1yp3mQP+jqBs2M7F47 XnDh8poSSAomyIe2bTznwgXIG7RhQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudekjedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucfgmhhpthihuchsuhgsjhgvtghtucdluddtmdenuc fjughrpefhvfffkfggtgesthdtredttddttdenucfhrhhomhepmfgvvhhinhcuuehruhgs vggtkhcufghnhhgrmhhmvghruceouhhnhhgrmhhmvghrsehfshhfvgdrohhrgheqnecugg ftrfgrthhtvghrnhepteduheejkeekjeefhefhkedtheeuheeuudevkefhledtkefhgfdu ffdvhfejleelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepuhhnhhgrmhhmvghrsehfshhfvgdrohhrgh X-ME-Proxy: From: Kevin Brubeck Unhammer To: control@debbugs.gnu.org Date: Wed, 24 Jun 2020 13:10:13 +0200 Message-ID: <878sgcg1nu.fsf@trigram.no> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 2.2 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: unarchive 30639 Content analysis details: (2.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [64.147.123.31 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: unarchive 30639 Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [64.147.123.31 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.0 TVD_SPACE_RATIO No description available. unarchive 30639 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 07:16:46 2020 Received: (at 30639) by debbugs.gnu.org; 24 Jun 2020 11:16:46 +0000 Received: from localhost ([127.0.0.1]:37865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jo3OV-0005PK-Ck for submit@debbugs.gnu.org; Wed, 24 Jun 2020 07:16:46 -0400 Received: from wforward2-smtp.messagingengine.com ([64.147.123.31]:39195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jo3OQ-0005Gu-Gg for 30639@debbugs.gnu.org; Wed, 24 Jun 2020 07:16:41 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailforward.west.internal (Postfix) with ESMTP id B1BD3C32; Wed, 24 Jun 2020 07:16:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 24 Jun 2020 07:16:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :resent-date:resent-from:resent-message-id:resent-to:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=jhuvfHSbXAe31O+nRPSMJzwwpCrGCqKO/tM5V/lvXLE=; b=orfa4MyG 20o1ZrxJDjBJDa48vgdCHqh+cpVCyM2Q+pFS1AsGeTB0S9lJhjVbsmk++4YT//lI D2JnEytraQyEHyVqrotQCtm5Q8Dq17mXAsmmVL4NB/4LHDTR3i3+NRer2heEGVbI BMBt8eKZt1vJUFB26u+cTQ7gzVJUNLloEnbBJJ3RSzIjS+LK0aa6g1U7p7QN5ebX uFGN+ARdSXkQIDMSDjrIpz9iXhmTtihvJOjswmm3Xk4shpeFdzuRhUpHPYMTNOV2 KHn4R5KDsPn5PjGmRIF07aDXXDIwMzIY1e1/sDBlzzaU4ZslqMkxjwdDsj81dz1B oMKkI/UxA7MvTw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudekjedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufhfffgjkfggtgfgsehtqhertddttdejnecuhfhrohhmpefmvghvihhn uceurhhusggvtghkucgfnhhhrghmmhgvrhcuoehunhhhrghmmhgvrhesfhhsfhgvrdhorh hgqeenucggtffrrghtthgvrhhnpeegffetvdeivddtteejgfevvdfhgfffjeefkeetudej jeejkeeileeiudehjeekudenucffohhmrghinhepghhnuhdrohhrghdpvghmrggtshifih hkihdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehunhhhrghmmhgvrhesfhhsfhgvrdhorhhg X-ME-Proxy: Resent-To: 30639@debbugs.gnu.org Resent-From: Kevin Brubeck Unhammer Resent-Date: Wed, 24 Jun 2020 13:16:29 +0200 Resent-Message-ID: <87o8p8emsy.fsf@fsfe.org> From: Kevin Brubeck Unhammer To: John Goerzen Subject: Re: bug#30639: 25.1; ERC buffer name not unique, broken on reconnect [patch] References: <877eqyrv80.fsf@complete.org> Date: Wed, 24 Jun 2020 11:12:35 +0200 In-Reply-To: <877eqyrv80.fsf@complete.org> (John Goerzen's message of "Tue, 27 Feb 2018 15:15:30 -0600") Message-ID: <87o8p8g73w.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 30639 Cc: 30639@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hi, This commit caused a regression: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D40121 cdefc045893a7fed57856ac385ab41c71f61c09f makes buffer #hello be used for *both* networks instead of #hello<2> created on the next network. And not just that, the other buffers on the same network will get their network changed (so if #goodbye was on network1, and you connect to network2 and join #hello there, #goodbye will say it's on network2). I haven't looked into doing this change correctly yet, but reverting it at least makes ERC work again for me. best regards, Kevin Brubeck Unhammer=20 John Goerzen =C4=8D=C3=A1lii: > Hi, > > Over at https://www.emacswiki.org/emacs/ErcBugs, there is a description > as follows: > > "When you're in two channels with the same name, e.g. #hello, on > different networks, the buffers are called #hello and #hello<2>. Now, if > you temporarily lose your connection (e.g. unplug the network cable and > plug it back in) and ERC reconnects, #hello<2> will not be re-used, but > instead #hello<3> will be created." > > I have observed this. This all goes back to a bug in > erc/erc.el:erc-generate-new-buffer-name > > The comments in the function as given are reasonable, but the logic > differs. In particular, the test in the dolist always fails when > (get-buffer candidate) is nil; that is, the test always fails when the > buffer does not already exist. This causes the test to drop through to > the section at the bottom every time, which results not only in the > server appending logic never being used, but also in the concatenation > of /server never being attempted. > > Here is a working replacement: > > (defun erc-generate-new-buffer-name (server port target) > "Create a new buffer name based on the arguments." > (when (numberp port) (setq port (number-to-string port))) > (let ((buf-name (or target > (or (let ((name (concat server ":" port))) > (when (> (length name) 1) > name)) > ;; This fallback should in fact never happen > "*erc-server-buffer*"))) > buffer-name) > ;; Reuse existing buffers, but not if the buffer is a connected ser= ver > ;; buffer and not if its associated with a different server than the > ;; current ERC buffer. > ;; if buf-name is taken by a different connection (or by something = !erc) > ;; then see if "buf-name/server" meets the same criteria > (dolist (candidate (list buf-name (concat buf-name "/" server))) > (if (and (not buffer-name) > erc-reuse-buffers > (or (not (get-buffer candidate)) > (or target > (with-current-buffer (get-buffer candidate) > (and (erc-server-buffer-p) > (not (erc-server-process-alive))))) > (with-current-buffer (get-buffer candidate) > (and (string=3D erc-session-server server) > (erc-port-equal erc-session-port port))))) > (setq buffer-name candidate))) > ;; if buffer-name is unset, neither candidate worked out for us, > ;; fallback to the old uniquification method: > (or buffer-name (generate-new-buffer-name (concat buf-name "/" serv= er))) )) > > > In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) > of 2017-09-15, modified by Debian built on trouble > Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 > System Description: Debian GNU/Linux 9.3 (stretch) > > Configured using: > 'configure --build x86_64-linux-gnu --prefix=3D/usr > --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib > --localstatedir=3D/var/lib --infodir=3D/usr/share/info > --mandir=3D/usr/share/man --with-pop=3Dyes > --enable-locallisppath=3D/etc/emacs25:/etc/emacs:/usr/local/share/emacs/= 25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-= lisp:/usr/share/emacs/site-lisp > --with-sound=3Dalsa --build x86_64-linux-gnu --prefix=3D/usr > --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib > --localstatedir=3D/var/lib --infodir=3D/usr/share/info > --mandir=3D/usr/share/man --with-pop=3Dyes > --enable-locallisppath=3D/etc/emacs25:/etc/emacs:/usr/local/share/emacs/= 25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-= lisp:/usr/share/emacs/site-lisp > --with-sound=3Dalsa --with-x=3Dyes --with-x-toolkit=3Dgtk3 > --with-toolkit-scroll-bars 'CFLAGS=3D-g -O2 > -fdebug-prefix-map=3D/build/emacs25-wN2qS3/emacs25-25.1+1=3D. -fstack-pr= otector-strong > -Wformat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time > -D_FORTIFY_SOURCE=3D2' LDFLAGS=3D-Wl,-z,relro' > > Configured features: > XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS > NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB > TOOLKIT_SCROLL_BARS GTK3 X11 > > Important settings: > value of $LANG: en_US.utf8 > locale-coding-system: utf-8-unix > > Major mode: mu4e:main > > > > > From unknown Mon Aug 18 03:03:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 22 Jul 2020 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator