GNU bug report logs - #32723
[PATCH] Fix erc-autojoin for same channel names on multiple servers

Previous Next

Package: emacs;

Reported by: Martin Kletzander <nert.pinx <at> gmail.com>

Date: Wed, 12 Sep 2018 15:46:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32723 in the body.
You can then email your comments to 32723 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Wed, 12 Sep 2018 15:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Martin Kletzander <nert.pinx <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 12 Sep 2018 15:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Martin Kletzander <nert.pinx <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix erc-autojoin for same channel names on multiple servers
Date: Wed, 12 Sep 2018 17:44:29 +0200
When auto-joining channel with the same name on
multiple channels the auto-join will go over the
list of channels and for each one it checks if
there is a buffer and alive server process.
However it does not check if the server process
matches the server being currently processed for
auto-joining.

This happens since commit "Don't join erc channels
doubly"

Fix it by checking if the currently processed
server matches the erc process name of the already
joined channel.

* lisp/erc/erc-join.el (erc-autojoin-channels):
Join channels with the same name on different
servers.

Copyright-paperwork-exempt: yes
---
 lisp/erc/erc-join.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index a6bf6518ea86..567a4cc27e19 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -161,6 +161,9 @@ This function is run from `erc-nickserv-identified-hook'."
 	      ;; Only auto-join the channels that we aren't already in
 	      ;; using a different nick.
 	      (when (or (not buffer)
+			;; If the same channel is joined on another
+			;; server the best-effort is to just join
+			(not (string-match (car l) (process-name erc-server-process)))
 			(not (with-current-buffer buffer
 			       (erc-server-process-alive))))
 		(erc-server-join-channel server chan))))))))
-- 
2.18.0





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Sun, 23 Jun 2019 21:54:01 GMT) Full text and rfc822 format available.

Message #8 received at 32723 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Martin Kletzander <nert.pinx <at> gmail.com>
Cc: 32723 <at> debbugs.gnu.org
Subject: Re: bug#32723: [PATCH] Fix erc-autojoin for same channel names on
 multiple servers
Date: Sun, 23 Jun 2019 23:53:23 +0200
Martin Kletzander <nert.pinx <at> gmail.com> writes:

> When auto-joining channel with the same name on
> multiple channels the auto-join will go over the
> list of channels and for each one it checks if
> there is a buffer and alive server process.
> However it does not check if the server process
> matches the server being currently processed for
> auto-joining.
>
> This happens since commit "Don't join erc channels
> doubly"
>
> Fix it by checking if the currently processed
> server matches the erc process name of the already
> joined channel.

Looks good to me; I've now applied it to the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 21:54:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 32723 <at> debbugs.gnu.org and Martin Kletzander <nert.pinx <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 21:54:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Jul 2019 11:24:07 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Kevin Brubeck Unhammer <unhammer <at> fsfe.org> to control <at> debbugs.gnu.org. (Sun, 10 May 2020 19:46:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Sun, 10 May 2020 19:47:01 GMT) Full text and rfc822 format available.

Message #19 received at 32723 <at> debbugs.gnu.org (full text, mbox):

From: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
Cc: 32723 <at> debbugs.gnu.org
Subject: Re: bug#32723: [PATCH] Fix erc-autojoin for same channel names on
 multiple servers
Date: Sun, 10 May 2020 21:45:54 +0200
[Message part 1 (text/plain, inline)]
Martin Kletzander <nert.pinx <at> gmail.com> čálii:

> When auto-joining channel with the same name on
> multiple channels the auto-join will go over the
> list of channels and for each one it checks if
> there is a buffer and alive server process.
> However it does not check if the server process
> matches the server being currently processed for
> auto-joining.
>
> This happens since commit "Don't join erc channels
> doubly"
>
> Fix it by checking if the currently processed
> server matches the erc process name of the already
> joined channel.

That's not always going to match though. The car's of
erc-autojoin-channels contain the values of erc-server-announced-name or
erc-session-server, not the process-name of
erc-server-process. E.g. when I join my weechat relay,
erc-session-server is "example.com" and erc-server-announced-name is
"weechat.relay.irc" while (process-name erc-server-process) is
"erc-example.com-9001<1>".

Also, the check is against the current erc-server-process (for the
server being joined). Isn't the intention of the patch to check against
the candidate buffer's server-process?

I would expect something like

	      (when (or (not buffer)
			;; If the same channel is joined on another
			;; server the best-effort is to just join
                        (not (with-current-buffer buffer
                               (or (string-match-p (car l) erc-session-server)
                                   (string-match-p (car l) erc-session-announced-name))))
			(not (with-current-buffer buffer
			       (erc-server-process-alive))))
		(erc-server-join-channel server chan))

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Mon, 11 May 2020 15:08:02 GMT) Full text and rfc822 format available.

Message #22 received at 32723 <at> debbugs.gnu.org (full text, mbox):

From: Martin Kletzander <nert.pinx <at> gmail.com>
To: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 32723 <at> debbugs.gnu.org
Subject: Re: bug#32723: [PATCH] Fix erc-autojoin for same channel names on
 multiple servers
Date: Mon, 11 May 2020 17:06:54 +0200
On Sun, May 10, 2020 at 09:32:38PM +0200, Kevin Brubeck Unhammer wrote:
>Martin Kletzander <nert.pinx <at> gmail.com> čálii:
>
>> When auto-joining channel with the same name on
>> multiple channels the auto-join will go over the
>> list of channels and for each one it checks if
>> there is a buffer and alive server process.
>> However it does not check if the server process
>> matches the server being currently processed for
>> auto-joining.
>>
>> This happens since commit "Don't join erc channels
>> doubly"
>>
>> Fix it by checking if the currently processed
>> server matches the erc process name of the already
>> joined channel.
>
>That's not always going to match though. The car's of
>erc-autojoin-channels contain the values of erc-server-announced-name or
>erc-session-server, not the process-name of
>erc-server-process. E.g. when I join my weechat relay,
>erc-session-server is "example.com" and erc-server-announced-name is
>"weechat.relay.irc" while (process-name erc-server-process) is
>"erc-example.com-9001<1>".
>

Oh, I completely forgot what I was doing there, I just know that with this patch
it is fixed for me, even though it might be dependent on various quirks that
just happen on my client (be it joining servers with very different latency, not
using autojoin twice or something completely different).

>Also, the check is against the current erc-server-process (for the
>server being joined). Isn't the intention of the patch to check against
>the candidate buffer's server-process?
>

As I said, I do not remember what exactly was the reason for this particular way
of dealing with it.  I definitely made some mistakes.

>I would expect something like
>
>	      (when (or (not buffer)
>			;; If the same channel is joined on another
>			;; server the best-effort is to just join
>                        (not (with-current-buffer buffer
>                               (or (string-match-p (car l) erc-session-server)
>                                   (string-match-p (car l) erc-session-announced-name))))
>			(not (with-current-buffer buffer
>			       (erc-server-process-alive))))
>		(erc-server-join-channel server chan))
>

If that works, then I'm fine with it. I can test it later on and let you know if
it works for me.

Thanks,
Martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Tue, 19 May 2020 18:26:02 GMT) Full text and rfc822 format available.

Message #25 received at 32723 <at> debbugs.gnu.org (full text, mbox):

From: Martin Kletzander <nert.pinx <at> gmail.com>
To: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 32723 <at> debbugs.gnu.org
Subject: Re: bug#32723: [PATCH] Fix erc-autojoin for same channel names on
 multiple servers
Date: Tue, 19 May 2020 20:25:24 +0200
On Mon, May 11, 2020 at 05:06:54PM +0200, Martin Kletzander wrote:
>On Sun, May 10, 2020 at 09:32:38PM +0200, Kevin Brubeck Unhammer wrote:
>>Martin Kletzander <nert.pinx <at> gmail.com> čálii:
>>
>>> When auto-joining channel with the same name on
>>> multiple channels the auto-join will go over the
>>> list of channels and for each one it checks if
>>> there is a buffer and alive server process.
>>> However it does not check if the server process
>>> matches the server being currently processed for
>>> auto-joining.
>>>
>>> This happens since commit "Don't join erc channels
>>> doubly"
>>>
>>> Fix it by checking if the currently processed
>>> server matches the erc process name of the already
>>> joined channel.
>>
>>That's not always going to match though. The car's of
>>erc-autojoin-channels contain the values of erc-server-announced-name or
>>erc-session-server, not the process-name of
>>erc-server-process. E.g. when I join my weechat relay,
>>erc-session-server is "example.com" and erc-server-announced-name is
>>"weechat.relay.irc" while (process-name erc-server-process) is
>>"erc-example.com-9001<1>".
>>
>
>Oh, I completely forgot what I was doing there, I just know that with this patch
>it is fixed for me, even though it might be dependent on various quirks that
>just happen on my client (be it joining servers with very different latency, not
>using autojoin twice or something completely different).
>
>>Also, the check is against the current erc-server-process (for the
>>server being joined). Isn't the intention of the patch to check against
>>the candidate buffer's server-process?
>>

So I just tried emacs-27.0.91 and with your approach it does not join any
channel on any server.  With my patch (which I just learned is in, I found out
that it could not be applied locally) it joins all channels, but there is only
one of those two that have the same name.  However if I try joining the other
one manually it joins, but does not create a buffer.  It only gets created once
someone posts to the channel.  I actually started writing that it does not get
joined while a message appeared out of nowhere, I thought it was a private query
because there was no header, nothing.  Only after that I realised it has a name
of the channel, but on the second server, so I deleted that part of the e-mail!

I think there is something wrong with some other part of erc-join (or erc), so
for a while I'm sticking to 26.* with my patch on top of it, but sooner or later
I'll have to figure that out (or someone else, maybe).  Unfortunately I'm
swamped with more important things lately.

>
>As I said, I do not remember what exactly was the reason for this particular way
>of dealing with it.  I definitely made some mistakes.
>
>>I would expect something like
>>
>>	      (when (or (not buffer)
>>			;; If the same channel is joined on another
>>			;; server the best-effort is to just join
>>                        (not (with-current-buffer buffer
>>                               (or (string-match-p (car l) erc-session-server)
>>                                   (string-match-p (car l) erc-session-announced-name))))
>>			(not (with-current-buffer buffer
>>			       (erc-server-process-alive))))
>>		(erc-server-join-channel server chan))
>>
>
>If that works, then I'm fine with it. I can test it later on and let you know if
>it works for me.
>
>Thanks,
>Martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Tue, 19 May 2020 18:41:01 GMT) Full text and rfc822 format available.

Message #28 received at 32723 <at> debbugs.gnu.org (full text, mbox):

From: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
To: Martin Kletzander <nert.pinx <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 32723 <at> debbugs.gnu.org
Subject: Re: bug#32723: [PATCH] Fix erc-autojoin for same channel names on
 multiple servers
Date: Tue, 19 May 2020 20:40:41 +0200
[Message part 1 (text/plain, inline)]
Martin Kletzander <nert.pinx <at> gmail.com> čálii:

> Only after that I realised it has a name
> of the channel, but on the second server, so I deleted that part of the e-mail!
>
> I think there is something wrong with some other part of erc-join (or erc), so
> for a while I'm sticking to 26.*

I also noticed this with Emacs 27 after writing you. ERC shows things
like #emacs <at> BitlBee (should be @freenode). I haven't been able to find
out what causes it (doesn't happen every time I connect to two servers,
only when I don't have time to investigate). Will report back if I
figure it out.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Tue, 19 May 2020 20:33:01 GMT) Full text and rfc822 format available.

Message #31 received at 32723 <at> debbugs.gnu.org (full text, mbox):

From: Corwin Brust <corwin <at> bru.st>
To: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 32723 <at> debbugs.gnu.org,
 Martin Kletzander <nert.pinx <at> gmail.com>
Subject: Re: bug#32723: [PATCH] Fix erc-autojoin for same channel names on
 multiple servers
Date: Tue, 19 May 2020 15:32:19 -0500
FWIW, and please forgive the top-posted reply:

This seems related to this bug I opened fairly recently:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40121#5

I'm not sure but I think this started happening for me after I pulled
in a new ERC from master to my ~/site-lisp, which was not too long
before I made the switch to Emacs 27 PR 1.  (I wanted Amin's patch to
make nicks highlight even when followed by a punctuation character.)

In any case this behavior has been consistent across all versions of
Emacs 27 I've used and started before I'd actually upgraded from Emacs
26.3, if I'm not mistaken.

Regards,
Corwin

On Tue, May 19, 2020 at 1:41 PM Kevin Brubeck Unhammer
<unhammer <at> fsfe.org> wrote:
>
> Martin Kletzander <nert.pinx <at> gmail.com> čálii:
>
> > Only after that I realised it has a name
> > of the channel, but on the second server, so I deleted that part of the e-mail!
> >
> > I think there is something wrong with some other part of erc-join (or erc), so
> > for a while I'm sticking to 26.*
>
> I also noticed this with Emacs 27 after writing you. ERC shows things
> like #emacs <at> BitlBee (should be @freenode). I haven't been able to find
> out what causes it (doesn't happen every time I connect to two servers,
> only when I don't have time to investigate). Will report back if I
> figure it out.



-- 
Corwin
corwin <at> bru.st




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32723; Package emacs. (Tue, 09 Jun 2020 14:53:02 GMT) Full text and rfc822 format available.

Message #34 received at 32723 <at> debbugs.gnu.org (full text, mbox):

From: Martin Kletzander <nert.pinx <at> gmail.com>
To: Corwin Brust <corwin <at> bru.st>
Cc: Kevin Brubeck Unhammer <unhammer <at> fsfe.org>, 32723 <at> debbugs.gnu.org,
 Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#32723: [PATCH] Fix erc-autojoin for same channel names on
 multiple servers
Date: Tue, 9 Jun 2020 16:52:07 +0200
On Tue, May 19, 2020 at 03:32:19PM -0500, Corwin Brust wrote:
>FWIW, and please forgive the top-posted reply:
>
>This seems related to this bug I opened fairly recently:
>
>  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40121#5
>
>I'm not sure but I think this started happening for me after I pulled
>in a new ERC from master to my ~/site-lisp, which was not too long
>before I made the switch to Emacs 27 PR 1.  (I wanted Amin's patch to
>make nicks highlight even when followed by a punctuation character.)
>
>In any case this behavior has been consistent across all versions of
>Emacs 27 I've used and started before I'd actually upgraded from Emacs
>26.3, if I'm not mistaken.
>

Sorry for such a late reply, just wanted to share that I experience the same
thing as you described in the bug, it happens on 27.0.91, but *not* on 26.3.

>Regards,
>Corwin
>
>On Tue, May 19, 2020 at 1:41 PM Kevin Brubeck Unhammer
><unhammer <at> fsfe.org> wrote:
>>
>> Martin Kletzander <nert.pinx <at> gmail.com> čálii:
>>
>> > Only after that I realised it has a name
>> > of the channel, but on the second server, so I deleted that part of the e-mail!
>> >
>> > I think there is something wrong with some other part of erc-join (or erc), so
>> > for a while I'm sticking to 26.*
>>
>> I also noticed this with Emacs 27 after writing you. ERC shows things
>> like #emacs <at> BitlBee (should be @freenode). I haven't been able to find
>> out what causes it (doesn't happen every time I connect to two servers,
>> only when I don't have time to investigate). Will report back if I
>> figure it out.
>
>
>
>-- 
>Corwin
>corwin <at> bru.st




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Jul 2020 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.