unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Trevor Arjeski <tmarjeski@gmail.com>
To: 74516@debbugs.gnu.org
Subject: bug#74516: 31.0.50; ERC 5.6.1-git: [PATCH] allow port as string in auth-source params
Date: Mon, 25 Nov 2024 00:29:07 +0300	[thread overview]
Message-ID: <87r070gw2k.fsf@gmail.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: erc-port-string-fix --]
[-- Type: text/x-patch, Size: 1480 bytes --]

From 9468a786fb8c0ef950117e78395592f2e11613c2 Mon Sep 17 00:00:00 2001
From: Trevor Arjeski <tmarjeski@gmail.com>
Date: Sun, 24 Nov 2024 23:35:41 +0300
Subject: [PATCH] erc: allow port as string in auth-source params

Checking the equality of the given `erc-session-port' with "irc" is
unnecessary since:

1. "irc" is already added to the list of ports
2. /etc/services may contain "ircs-u" (or other) as the desired port

If the correct port/service is missing then the auth-source query will
fail for a seemingly unknown reason.

This also allows a user to `(setopt erc-port "1234")', intentionally or
accidentally, and still be able to use .authinfo for password
management.
---
 lisp/erc/erc.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 7028d0a68cc..81818a7227e 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -4675,8 +4675,7 @@ erc--auth-source-determine-params-defaults
                   (list net erc-server-announced-name erc-session-server)))
          (ports (list (cl-typecase erc-session-port
                         (integer (number-to-string erc-session-port))
-                        (string (and (string= erc-session-port "irc")
-                                     erc-session-port)) ; or nil
+                        (string erc-session-port) ; or nil
                         (t erc-session-port))
                       "irc")))
     (list (cons :host (delq nil hosts))
-- 
2.47.0


[-- Attachment #2: Type: text/plain, Size: 7988 bytes --]


Reproduction steps:

1. Have an entry in .authinfo, such as
        machine yourbouncer login nick password hunter2 port 7777

2. Using the following code in init.el, open emacs
3. M-x erc-connect
4. Notice ERC tries connecting without password
5. Change erc-port to be an integer (commented out below)
6. Retry steps 2 - 4

#+BEGIN_SRC emacs-lisp
(use-package erc
  :ensure nil
  :preface
  (defun erc-connect ()
    (interactive)
    (erc :server erc-server
         :port erc-port
         :user erc-nick))
  :custom
  (erc-server "yourbouncer")
  (erc-port "7777") ;; (erc-port 7777) is working
  (erc-nick "nick"))
#+END_SRC


In GNU Emacs 31.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2024-11-14 built on trevarch
Repository revision: b83a45eab53b8e6d8f3be45c0acb9a42a5262cb0
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-m17n-flt --without-gconf
 --with-native-compilation=yes --with-xinput2 --with-x-toolkit=gtk3
 --without-xaw3d --with-sound=no --with-tree-sitter --without-gpm
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -Wno-implicit-function-declaration -g
 -ffile-prefix-map=/home/trev/Workspace/emacs-git/src=/usr/src/debug/emacs-git
 -flto=auto' 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed
 -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ERC

Minor modes in effect:
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-spelling-mode: t
  flyspell-mode: t
  erc-ring-mode: t
  erc-nicks-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-match-mode: t
  erc-list-mode: t
  erc-irccontrols-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  erc-imenu-mode: t
  erc-pcomplete-mode: t
  erc-button--phantom-users-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-networks-mode: t
  global-treesit-auto-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  savehist-mode: t
  vertico-mode: t
  undo-fu-session-global-mode: t
  undo-fu-session-mode: t
  which-key-mode: t
  electric-pair-mode: t
  global-auto-revert-mode: t
  desktop-save-mode: t
  recentf-mode: t
  save-place-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/.emacs.d//lisp/aoc hides /home/trev/.emacs.d/elpa/aoc-1.0.0/aoc
~/.emacs.d//lisp/launch-program hides /home/trev/.emacs.d/elpa/launch-program-1.0.0/launch-program
~/.emacs.d//lisp/my-secrets hides /home/trev/.emacs.d/elpa/my-secrets-1.0.0/my-secrets
/home/trev/.emacs.d/elpa/transient-20241115.2034/transient hides /usr/share/emacs/31.0.50/lisp/transient

Features:
(shadow sort comp-run comp-common mail-extr emacsbug message yank-media
dired dired-loaddefs rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums ace-window avy cape-char cape mule-util orderless
network-stream puny nsm erc-track erc-spelling flyspell ispell erc-ring
erc-nicks color erc-netsplit erc-menu erc-match erc-list erc-goodies
erc-imenu imenu erc-pcomplete pcomplete erc-button erc-fill erc-stamp
erc-join my-secrets cus-start epa-file epa derived epg rfc6068
epg-config erc format-spec erc-backend erc-networks erc-common
erc-compat erc-loaddefs paredit display-line-numbers rx ligature
rainbow-delimiters format-all language-id inheritenv init gnus nnheader
gnus-util time-date mail-utils range mm-util mail-prsvr cus-edit pp
treesit-auto treesit corfu-popupinfo corfu marginalia savehist vertico
compat grep compile text-property-search comint ansi-osc ansi-color ring
cus-load finder-inf undo-fu-session which-key diminish
doom-themes-ext-org doom-nord-theme pcase doom-themes doom-themes-base
edmacro kmacro elec-pair autorevert filenotify desktop frameset recentf
tree-widget wid-edit saveplace use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util mailcap url-handlers url-parse auth-source eieio eieio-core
icons password-cache json subr-x map byte-opt url-vars cl-macs gv
cl-extra help-mode cl-seq use-package-core cl-loaddefs cl-lib bytecomp
byte-compile info ace-window-autoloads aoc-autoloads avy-autoloads
cape-autoloads consult-autoloads corfu-autoloads debbugs-autoloads
diff-hl-autoloads diminish-autoloads doom-themes-autoloads eat-autoloads
elfeed-autoloads envrc-autoloads format-all-autoloads
geiser-guile-autoloads geiser-autoloads git-modes-autoloads
helpful-autoloads elisp-refs-autoloads f-autoloads inheritenv-autoloads
language-id-autoloads launch-program-autoloads leetcode-autoloads
aio-autoloads ligature-autoloads log4e-autoloads magit-autoloads
magit-section-autoloads dash-autoloads marginalia-autoloads
markdown-mode-autoloads my-secrets-autoloads nerd-icons-dired-autoloads
nerd-icons-autoloads orderless-autoloads paredit-autoloads
rainbow-delimiters-autoloads rainbow-mode-autoloads request-autoloads
rust-mode-autoloads s-autoloads sly-autoloads transient-autoloads
treesit-auto-autoloads undo-fu-autoloads undo-fu-session-autoloads
vertico-autoloads with-editor-autoloads ws-butler-autoloads early-init
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen 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 nadvice seq simple cl-generic indonesian philippine
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 abbrev obarray oclosure
cl-preloaded button loaddefs theme-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 dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 532575 259144) (symbols 48 21073 0) (strings 32 81801 33581)
 (string-bytes 1 2864363) (vectors 16 34038) (vector-slots 8 428812 185464)
 (floats 8 504 8884) (intervals 56 17700 11521) (buffers 992 19))


             reply	other threads:[~2024-11-24 21:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-24 21:29 Trevor Arjeski [this message]
2024-11-26  3:36 ` bug#74516: 31.0.50; ERC 5.6.1-git: [PATCH] allow port as string in auth-source params J.P.
     [not found] ` <87bjy2ekf3.fsf@neverwas.me>
2024-11-26  5:33   ` Trevor Arjeski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r070gw2k.fsf@gmail.com \
    --to=tmarjeski@gmail.com \
    --cc=74516@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).