unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* 28.0.50; ERC now ignores dialed server names in autojoin
@ 2021-11-21  0:15 J.P.
  2021-11-21 11:31 ` bug#52010: 28.0.60; " J.P.
  2021-11-22  1:43 ` J.P.
  0 siblings, 2 replies; 3+ messages in thread
From: J.P. @ 2021-11-21  0:15 UTC (permalink / raw)
  To: bug-gnu-emacs; +Cc: emacs-erc

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

Tags: patch

A recent addition [1] to ERC (and now Emacs 28) introduced a breaking
change that's set to create some churn for (what I suspect will be) a
noticeable swath of ERC users. First off, this is solely my fault
because I advocated for this addition without envisioning, much less
trying to forestall, the coming disruption [2].

What this boils down to is that folks with an entry like
("irc.libera.chat" "#libera") in their `erc-autojoin-channels-alist'
will find that it no longer works because ERC now matches against what's
called the "announced" name (e.g., "foo.libera.chat") rather than the
"dialed" name ("irc.libera.chat" or "localhost" or "my.vps.net") [3].

Anyway, apologies for the delay in bringing this to the tracker [4]. The
attached patch attempts to right the offending portions while preserving
the benefits introduced by [1], which I still believe to be significant.
Please direct your daggers toward me and not [1]'s author. Thanks.

P.S. Tests for this reside in #48598.


Notes
~~~~~

[1] commit 9bb8d90cddf11df3aecdc6c04e762773dfa0cb92
    Allow irc network symbols in erc-autojoin-channels-alist

[2] I suppose I've been so preoccupied with whining about the underlying
    problem this exposes (mostly in my progress reports for #48598) that
    I neglected to confront the reality of [1] becoming the last word on
    join-related business for a good while. IOW, having #48598's patch
    set build on [1]'s changes while believing wholeheartedly that both
    would make it into 28 was classic hubris on my part in that it drove
    me to "forget" to consider what would happen if the two ever found
    themselves on opposite sides of a release divide. Which they have.

[3] In reality, "announced" is favored only when set, which is basically
    always because the 004 handler runs right on the heels of connection
    registration. For anyone who cares, kensanata added the fallback in
    2005, right around when `erc-announced-server-name' became
    `erc-server-announced-name'.

    BTW, this new reorienting toward the "announced" name isn't actually
    the focus of [1], which is more about elevating network names to
    equal footing. And it isn't really "new" at all but more like a
    restoration of what's historically been the preferred (and, from
    2001 to 2005, only) means of referring to an IRC session. Only in
    the last few years or so has ERC actually been conflicted in this
    regard.

[4] For a couple weeks now, I've been trying to reach out to the person
    who initially brought this to our attention on Libera, but that's
    become a lost cause. I mainly wanted to confirm that their
    suspicions of this being an Emacs-29-only thing were in fact wrong,
    which I'm now certain of.


In GNU Emacs 29.0.50 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-11-18 built on localhost
Repository revision: 69f1bc43c026049ed2aab6a6368e2e9a5406b779
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Fedora 34 (Workstation Edition)

Configured using:
 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs
 --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu
 --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
 --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share
 --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec
 --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz
 --with-cairo --with-json build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-O0 -g3'
 LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
WEBP X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map
text-property-search time-date seq gv subr-x byte-opt bytecomp
byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils help-mode cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget keymap hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 53474 6237)
 (symbols 48 6794 1)
 (strings 32 19269 1625)
 (string-bytes 1 642335)
 (vectors 16 14025)
 (vector-slots 8 189932 12509)
 (floats 8 22 37)
 (intervals 56 262 0)
 (buffers 992 10))

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Fall-back-on-dialed-server-names-in-erc-join.patch --]
[-- Type: text/x-patch, Size: 2809 bytes --]

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Wed, 10 Nov 2021 23:42:42 -0800
Subject: [PATCH 02/29] Fall back on dialed server names in erc-join

* lisp/erc/erc-join.el (erc-autojoin-server-match,
erc-autojoin-current-server): as a fallback, always try the original
server param passed to `erc-open' when matching against members of
`erc-autojoin-channels-alist'.  Similarly, when adding and removing
items, only apply the `erc-autojoin-domain-only' truncation treatment
to "announced" servers.
---
 lisp/erc/erc-join.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 2ed8622b85..1a6bdedc98 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -103,7 +103,11 @@ erc-autojoin-domain-only
 If non-nil, and a channel on the server a.b.c is joined, then
 only b.c is used as the server for `erc-autojoin-channels-alist'.
 This is important for networks that redirect you to other
-servers, presumably in the same domain."
+servers, presumably in the same domain.
+
+This treatment will only be applied to so-called \"announced names\",
+like zirconium.libera.chat, but not to \"dialed\" hostnames, like
+my.proxy.localdomain or my.vps.example.com."
   :type 'boolean)
 
 (defvar-local erc--autojoin-timer nil)
@@ -127,9 +131,9 @@ erc-autojoin-server-match
 This should be a key from `erc-autojoin-channels-alist'."
   (or (eq candidate (erc-network))
       (and (stringp candidate)
-	   (string-match-p candidate
-                           (or erc-server-announced-name
-			       erc-session-server)))))
+           (or (and erc-server-announced-name ; unnecessary after #48598
+                    (string-match-p candidate erc-server-announced-name))
+               (string-match-p candidate erc-session-server)))))
 
 (defun erc-autojoin-after-ident (_network _nick)
   "Autojoin channels in `erc-autojoin-channels-alist'.
@@ -184,11 +188,12 @@ erc-autojoin-channels
 (defun erc-autojoin-current-server ()
   "Compute the current server for lookup in `erc-autojoin-channels-alist'.
 Respects `erc-autojoin-domain-only'."
-  (let ((server (or erc-server-announced-name erc-session-server)))
-    (if (and erc-autojoin-domain-only
-	     (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
-	(match-string 1 server)
-      server)))
+  (if (and erc-autojoin-domain-only
+           erc-server-announced-name
+           (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$"
+                         erc-server-announced-name))
+      (match-string 1 erc-server-announced-name)
+    erc-session-server))
 
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
-- 
2.31.1


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

* bug#52010: 28.0.60; ERC now ignores dialed server names in autojoin
  2021-11-21  0:15 28.0.50; ERC now ignores dialed server names in autojoin J.P.
@ 2021-11-21 11:31 ` J.P.
  2021-11-22  1:43 ` J.P.
  1 sibling, 0 replies; 3+ messages in thread
From: J.P. @ 2021-11-21 11:31 UTC (permalink / raw)
  To: 52010; +Cc: emacs-erc

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

v2: a small tweak to leave a tidier footprint for git-blame.


Also, some slight corrections on the timeline:


  Jan 20, 2003 - Register autojoin function with `erc-after-connect'
                 hook, which passes in `erc-announced-server-name' for
                 function's server param

  Jun 26, 2005 - Add dialed server as fallback when announced name
                 missing

  Sep 16, 2005 - Deprecate `erc-announced-server-name' in favor of
                 `erc-server-announced-name'

  Jan 05, 2017 - Switch from announced to dialed, ignoring server param
                 provided by `erc-after-connect' hook

  Sep 16, 2021 - Switch from dialed to announced, but consider networks

    This patch - Stay the course, but always fall back to dialed (not
                 just when unset)

    Bug #48598 - Prefer unique session identifiers based around and
                 compatible with networks, but fall back on announced,
                 then dialed (for compatibility)



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0000-v1-v2.diff --]
[-- Type: text/x-patch, Size: 2308 bytes --]

From e804e5c160b8ee1fa1ad2e1af7bcf3dd694cd14b Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Sat, 20 Nov 2021 23:53:49 -0800
Subject: NOT A PATCH

F. Jason Park (1):
  Fall back on dialed server names in erc-join

 lisp/erc/erc-join.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Interdiff:
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 1a6bdedc98..887c40a00c 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -105,9 +105,9 @@ erc-autojoin-domain-only
 This is important for networks that redirect you to other
 servers, presumably in the same domain.
 
-This treatment will only be applied to so-called \"announced names\",
-like zirconium.libera.chat, but not to \"dialed\" hostnames, like
-my.proxy.localdomain or my.vps.example.com."
+This treatment will only be applied to so-called \"announced\" names,
+like zirconium.libera.chat, but not to \"dialed\" names, like
+209.51.188.117 or my.vps.example.net."
   :type 'boolean)
 
 (defvar-local erc--autojoin-timer nil)
@@ -131,7 +131,7 @@ erc-autojoin-server-match
 This should be a key from `erc-autojoin-channels-alist'."
   (or (eq candidate (erc-network))
       (and (stringp candidate)
-           (or (and erc-server-announced-name ; unnecessary after #48598
+           (or (and erc-server-announced-name
                     (string-match-p candidate erc-server-announced-name))
                (string-match-p candidate erc-session-server)))))
 
@@ -188,12 +188,12 @@ erc-autojoin-channels
 (defun erc-autojoin-current-server ()
   "Compute the current server for lookup in `erc-autojoin-channels-alist'.
 Respects `erc-autojoin-domain-only'."
-  (if (and erc-autojoin-domain-only
-           erc-server-announced-name
-           (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$"
-                         erc-server-announced-name))
-      (match-string 1 erc-server-announced-name)
-    erc-session-server))
+  (let ((server erc-server-announced-name))
+    (if (and erc-autojoin-domain-only
+             server
+	     (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
+	(match-string 1 server)
+      erc-session-server)))
 
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
-- 
2.31.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-Fall-back-on-dialed-server-names-in-erc-join.patch --]
[-- Type: text/x-patch, Size: 2594 bytes --]

From e804e5c160b8ee1fa1ad2e1af7bcf3dd694cd14b Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Wed, 10 Nov 2021 23:42:42 -0800
Subject: [PATCH 1/1] Fall back on dialed server names in erc-join

* lisp/erc/erc-join.el (erc-autojoin-server-match,
erc-autojoin-current-server): as a fallback, always try the original
server argument passed to `erc-open' when matching against members of
`erc-autojoin-channels-alist'.  Similarly, when adding and removing
items, only apply the `erc-autojoin-domain-only' truncation treatment
to "announced" servers.
---
 lisp/erc/erc-join.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 2ed8622b85..887c40a00c 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -103,7 +103,11 @@ erc-autojoin-domain-only
 If non-nil, and a channel on the server a.b.c is joined, then
 only b.c is used as the server for `erc-autojoin-channels-alist'.
 This is important for networks that redirect you to other
-servers, presumably in the same domain."
+servers, presumably in the same domain.
+
+This treatment will only be applied to so-called \"announced\" names,
+like zirconium.libera.chat, but not to \"dialed\" names, like
+209.51.188.117 or my.vps.example.net."
   :type 'boolean)
 
 (defvar-local erc--autojoin-timer nil)
@@ -127,9 +131,9 @@ erc-autojoin-server-match
 This should be a key from `erc-autojoin-channels-alist'."
   (or (eq candidate (erc-network))
       (and (stringp candidate)
-	   (string-match-p candidate
-                           (or erc-server-announced-name
-			       erc-session-server)))))
+           (or (and erc-server-announced-name
+                    (string-match-p candidate erc-server-announced-name))
+               (string-match-p candidate erc-session-server)))))
 
 (defun erc-autojoin-after-ident (_network _nick)
   "Autojoin channels in `erc-autojoin-channels-alist'.
@@ -184,11 +188,12 @@ erc-autojoin-channels
 (defun erc-autojoin-current-server ()
   "Compute the current server for lookup in `erc-autojoin-channels-alist'.
 Respects `erc-autojoin-domain-only'."
-  (let ((server (or erc-server-announced-name erc-session-server)))
+  (let ((server erc-server-announced-name))
     (if (and erc-autojoin-domain-only
+             server
 	     (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
 	(match-string 1 server)
-      server)))
+      erc-session-server)))
 
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
-- 
2.31.1


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

* bug#52010: 28.0.60; ERC now ignores dialed server names in autojoin
  2021-11-21  0:15 28.0.50; ERC now ignores dialed server names in autojoin J.P.
  2021-11-21 11:31 ` bug#52010: 28.0.60; " J.P.
@ 2021-11-22  1:43 ` J.P.
  1 sibling, 0 replies; 3+ messages in thread
From: J.P. @ 2021-11-22  1:43 UTC (permalink / raw)
  To: 52010; +Cc: emacs-erc

Actually, please ignore everything stated previously (and the patch as
well).

The 2017 change [1] was *not* the source of the problem as wrongly
implied in my previous email (although it did get the ball rolling by
changing from announced to dialed names for auth-source queries). The
real culprit is actually something way more recent [2]:

  diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
  index e4faf6bd79..79c111082f 100644
  --- a/lisp/erc/erc-join.el
  +++ b/lisp/erc/erc-join.el
  @@ -153,18 +153,20 @@ erc-autojoin-channels
                                'erc-autojoin-channels-delayed
                                server nick (current-buffer))))
       ;; `erc-autojoin-timing' is `connect':
  -    (dolist (l erc-autojoin-channels-alist)
  -      (when (string-match (car l) server)
  -       (let ((server (or erc-session-server erc-server-announced-name)))
  +    (let ((server (or erc-session-server erc-server-announced-name)))
  +      (dolist (l erc-autojoin-channels-alist)
  +        (when (string-match-p (car l) server)

But its damage has already been undone by [3] (IOW, there's no
regression)! So everything's fine as long as we don't mind a bit of
churn for folks on master who may have adjusted their autojoin alists in
the meantime (since August 2020 or so).

I suppose if we *really* wanted to be thorough, we could add an entry to
etc/ERC-NEWS saying a problem introduced in early in Emacs-28
development has been fixed and that any entries in
`erc-autojoin-channels-alist' containing dialed host names as keys
should use networks or partial announced domains instead. But, IMO,
that's unnecessary.

Thanks, and apologies (yet again) for the noise.


[1] commit 927dcbd2e6e0e53fcfb09296716e11c002ab1518
    Fix erc-join with channel password

[2] commit 88567ca8ecb505a59157af6338ebe355a304182b
    Fix erc-reuse-buffers behavior

[3] commit 9bb8d90cddf11df3aecdc6c04e762773dfa0cb92
    Allow irc network symbols in erc-autojoin-channels-alist





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

end of thread, other threads:[~2021-11-22  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21  0:15 28.0.50; ERC now ignores dialed server names in autojoin J.P.
2021-11-21 11:31 ` bug#52010: 28.0.60; " J.P.
2021-11-22  1:43 ` J.P.

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).