Package: emacs;
Reported by: Roman Rusch <roman.rusch <at> gmx.ch>
Date: Mon, 11 Aug 2025 04:09:03 UTC
Severity: normal
Found in version 30.1
Done: Eli Zaretskii <eliz <at> gnu.org>
To reply to this bug, email your comments to 79214 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#79214
; Package emacs
.
(Mon, 11 Aug 2025 04:09:03 GMT) Full text and rfc822 format available.Roman Rusch <roman.rusch <at> gmx.ch>
:bug-gnu-emacs <at> gnu.org
.
(Mon, 11 Aug 2025 04:09:03 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Roman Rusch <roman.rusch <at> gmx.ch> To: bug-gnu-emacs <at> gnu.org Subject: 30.1; rmail with two remote mailboxes and both passwords in .authinfo.gpg Date: Sun, 10 Aug 2025 20:02:29 +0200
Dear Sir or Madam, I've set up emacs rmail to withdraw the emails from two remote Mailboxes (with gnu movemail) and store it in one local inbox by having two entrances in rmail-inbox list like below: rmail-inbox-list '("pops://XXX" "pops://YYY") The password for both accounts are correctly stored in a .authinfo.gpg file, as described in the Info-page "Auth-source" for Emacs. The two passwords are different. The bug is that the command to get the emails always triggers an "authentication failed" for the second account - whatever the order in the above list is. But the authentication always works when in rmail-inbox-list only one account is defined. It took me a while to figure out that rmail is NOT reading in the password from the .authinfo.gpg file at all for the second account, because it already has read in one before and thinks it does not have to do so anymore. As a consequence it uses the password of the first account also for the second one, which causes the "authentication failed" error. I believe I've found the reason for the above problem in the file "rmail.el" -> "defun rmail-get-remote-password". By commenting out the first "when" expression as shown below I could at least make it work again for my case: ;;(when (not rmail-encoded-remote-password) (if (not rmail-remote-password) (setq rmail-remote-password (let ((found (nth 0 (auth-source-search :max 1 :user user :host host :require '(:secret))))) (if found (auth-info-password found) (read-passwd (if imap "IMAP password: " "POP password: ")))))) (rmail-set-remote-password rmail-remote-password) (setq rmail-remote-password nil);;) (rmail-encode-string rmail-encoded-remote-password (emacs-pid)) ) I like rmail a lot for its simplicity and hope this helps to make it even better. Best regards, Roman
bug-gnu-emacs <at> gnu.org
:bug#79214
; Package emacs
.
(Sat, 16 Aug 2025 11:19:02 GMT) Full text and rfc822 format available.Message #8 received at 79214 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Roman Rusch <roman.rusch <at> gmx.ch> Cc: 79214 <at> debbugs.gnu.org Subject: Re: bug#79214: 30.1; rmail with two remote mailboxes and both passwords in .authinfo.gpg Date: Sat, 16 Aug 2025 14:18:23 +0300
> Date: Sun, 10 Aug 2025 20:02:29 +0200 > From: Roman Rusch via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> > > Dear Sir or Madam, > > I've set up emacs rmail to withdraw the emails from two remote > Mailboxes (with gnu movemail) and store it in one local inbox by > having two entrances in rmail-inbox list like below: > > rmail-inbox-list '("pops://XXX" > "pops://YYY") > > The password for both accounts are correctly stored in a .authinfo.gpg > file, as described in the Info-page "Auth-source" for Emacs. The two > passwords are different. > > The bug is that the command to get the emails always triggers an > "authentication failed" for the second account - whatever the order in > the above list is. But the authentication always works when in > rmail-inbox-list only one account is defined. > > It took me a while to figure out that rmail is NOT reading in the > password from the .authinfo.gpg file at all for the second account, > because it already has read in one before and thinks it does not have > to do so anymore. As a consequence it uses the password of the first > account also for the second one, which causes the "authentication > failed" error. > > I believe I've found the reason for the above problem in the file > "rmail.el" -> "defun rmail-get-remote-password". By commenting out the > first "when" expression as shown below I could at least make it work > again for my case: > > ;;(when (not rmail-encoded-remote-password) > (if (not rmail-remote-password) > (setq rmail-remote-password > (let ((found (nth 0 (auth-source-search > :max 1 :user user :host host > :require '(:secret))))) > (if found > (auth-info-password found) > (read-passwd (if imap > "IMAP password: " > "POP password: ")))))) > (rmail-set-remote-password rmail-remote-password) > (setq rmail-remote-password nil);;) > (rmail-encode-string rmail-encoded-remote-password (emacs-pid)) > ) Thanks. I don't use multiple POP inboxes, so I wonder whether you could implement a simple change along the lines below and test it in your environment: . introduce 2 new variables, rmail-remote-password-host and rmail-remote-password-user . in rmail-get-remote-password record the values of the USER and HOST arguments in the above 2 variables . replace this condition in rmail-get-remote-password: (when (not rmail-encoded-remote-password) with (when (or (not rmail-encoded-remote-password) (not (equal user rmail-remote-password-user)) (not (equal host rmail-remote-password-host))) This should cause Rmail to ask you for the password, but only when it needs to fetch email from an inbox different from the one used before. Which I think is what you want.
bug-gnu-emacs <at> gnu.org
:bug#79214
; Package emacs
.
(Sat, 16 Aug 2025 14:55:02 GMT) Full text and rfc822 format available.Message #11 received at 79214 <at> debbugs.gnu.org (full text, mbox):
From: Roman Rusch <roman.rusch <at> gmx.ch> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 79214 <at> debbugs.gnu.org Subject: Re: bug#79214: 30.1; rmail with two remote mailboxes and both passwords in .authinfo.gpg Date: Sat, 16 Aug 2025 16:53:55 +0200
> Date: Sat, 16 Aug 2025 14:18:23 +0300 > From: Eli Zaretskii <eliz <at> gnu.org> > Cc: 79214 <at> debbugs.gnu.org > > > Date: Sun, 10 Aug 2025 20:02:29 +0200 > > From: Roman Rusch via "Bug reports for GNU Emacs, > > the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> > > > > Dear Sir or Madam, > > > > I've set up emacs rmail to withdraw the emails from two remote > > Mailboxes (with gnu movemail) and store it in one local inbox by > > having two entrances in rmail-inbox list like below: > > > > rmail-inbox-list '("pops://XXX" > > "pops://YYY") > > > > The password for both accounts are correctly stored in a .authinfo.gpg > > file, as described in the Info-page "Auth-source" for Emacs. The two > > passwords are different. > > > > The bug is that the command to get the emails always triggers an > > "authentication failed" for the second account - whatever the order in > > the above list is. But the authentication always works when in > > rmail-inbox-list only one account is defined. > > > > It took me a while to figure out that rmail is NOT reading in the > > password from the .authinfo.gpg file at all for the second account, > > because it already has read in one before and thinks it does not have > > to do so anymore. As a consequence it uses the password of the first > > account also for the second one, which causes the "authentication > > failed" error. > > > > I believe I've found the reason for the above problem in the file > > "rmail.el" -> "defun rmail-get-remote-password". By commenting out the > > first "when" expression as shown below I could at least make it work > > again for my case: > > > > ;;(when (not rmail-encoded-remote-password) > > (if (not rmail-remote-password) > > (setq rmail-remote-password > > (let ((found (nth 0 (auth-source-search > > :max 1 :user user :host host > > :require '(:secret))))) > > (if found > > (auth-info-password found) > > (read-passwd (if imap > > "IMAP password: " > > "POP password: ")))))) > > (rmail-set-remote-password rmail-remote-password) > > (setq rmail-remote-password nil);;) > > (rmail-encode-string rmail-encoded-remote-password (emacs-pid)) > > ) > > Thanks. I don't use multiple POP inboxes, so I wonder whether you > could implement a simple change along the lines below and test it in > your environment: > > . introduce 2 new variables, rmail-remote-password-host and > rmail-remote-password-user > . in rmail-get-remote-password record the values of the USER and HOST > arguments in the above 2 variables > . replace this condition in rmail-get-remote-password: > > (when (not rmail-encoded-remote-password) > > with > > (when (or (not rmail-encoded-remote-password) > (not (equal user rmail-remote-password-user)) > (not (equal host rmail-remote-password-host))) > > This should cause Rmail to ask you for the password, but only when it > needs to fetch email from an inbox different from the one used before. > Which I think is what you want. > Hi Eli, Thank you for your email. I can confirm your proposal works with my environment. Below is what I did around the defun in rmail.el, without the docstring: (setq rmail-remote-password-host "" rmail-remote-password-user "") (defun rmail-get-remote-password (imap user host) (when (or (not rmail-encoded-remote-password) (not (equal user rmail-remote-password-user)) (not (equal host rmail-remote-password-host))) (setq rmail-remote-password-host host rmail-remote-password-user user) (if (not rmail-remote-password) (setq rmail-remote-password (let ((found (nth 0 (auth-source-search :max 1 :user user :host host :require '(:secret))))) (if found (auth-info-password found) (read-passwd (if imap "IMAP password: " "POP password: ")))))) (rmail-set-remote-password rmail-remote-password) (setq rmail-remote-password nil)) (rmail-encode-string rmail-encoded-remote-password (emacs-pid)) ) -- Regards, Roman
Eli Zaretskii <eliz <at> gnu.org>
:Roman Rusch <roman.rusch <at> gmx.ch>
:Message #16 received at 79214-done <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Roman Rusch <roman.rusch <at> gmx.ch> Cc: 79214-done <at> debbugs.gnu.org Subject: Re: bug#79214: 30.1; rmail with two remote mailboxes and both passwords in .authinfo.gpg Date: Sat, 23 Aug 2025 14:57:34 +0300
> Date: Sat, 16 Aug 2025 16:53:55 +0200 > From: Roman Rusch <roman.rusch <at> gmx.ch> > Cc: 79214 <at> debbugs.gnu.org > > > Date: Sat, 16 Aug 2025 14:18:23 +0300 > > From: Eli Zaretskii <eliz <at> gnu.org> > > Cc: 79214 <at> debbugs.gnu.org > > > > > Date: Sun, 10 Aug 2025 20:02:29 +0200 > > > From: Roman Rusch via "Bug reports for GNU Emacs, > > > the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> > > > > > > Dear Sir or Madam, > > > > > > I've set up emacs rmail to withdraw the emails from two remote > > > Mailboxes (with gnu movemail) and store it in one local inbox by > > > having two entrances in rmail-inbox list like below: > > > > > > rmail-inbox-list '("pops://XXX" > > > "pops://YYY") > > > > > > The password for both accounts are correctly stored in a .authinfo.gpg > > > file, as described in the Info-page "Auth-source" for Emacs. The two > > > passwords are different. > > > > > > The bug is that the command to get the emails always triggers an > > > "authentication failed" for the second account - whatever the order in > > > the above list is. But the authentication always works when in > > > rmail-inbox-list only one account is defined. > > > > > > It took me a while to figure out that rmail is NOT reading in the > > > password from the .authinfo.gpg file at all for the second account, > > > because it already has read in one before and thinks it does not have > > > to do so anymore. As a consequence it uses the password of the first > > > account also for the second one, which causes the "authentication > > > failed" error. > > > > > > I believe I've found the reason for the above problem in the file > > > "rmail.el" -> "defun rmail-get-remote-password". By commenting out the > > > first "when" expression as shown below I could at least make it work > > > again for my case: > > > > > > ;;(when (not rmail-encoded-remote-password) > > > (if (not rmail-remote-password) > > > (setq rmail-remote-password > > > (let ((found (nth 0 (auth-source-search > > > :max 1 :user user :host host > > > :require '(:secret))))) > > > (if found > > > (auth-info-password found) > > > (read-passwd (if imap > > > "IMAP password: " > > > "POP password: ")))))) > > > (rmail-set-remote-password rmail-remote-password) > > > (setq rmail-remote-password nil);;) > > > (rmail-encode-string rmail-encoded-remote-password (emacs-pid)) > > > ) > > > > Thanks. I don't use multiple POP inboxes, so I wonder whether you > > could implement a simple change along the lines below and test it in > > your environment: > > > > . introduce 2 new variables, rmail-remote-password-host and > > rmail-remote-password-user > > . in rmail-get-remote-password record the values of the USER and HOST > > arguments in the above 2 variables > > . replace this condition in rmail-get-remote-password: > > > > (when (not rmail-encoded-remote-password) > > > > with > > > > (when (or (not rmail-encoded-remote-password) > > (not (equal user rmail-remote-password-user)) > > (not (equal host rmail-remote-password-host))) > > > > This should cause Rmail to ask you for the password, but only when it > > needs to fetch email from an inbox different from the one used before. > > Which I think is what you want. > > > Hi Eli, > > Thank you for your email. I can confirm your proposal works with my > environment. Below is what I did around the defun in rmail.el, without > the docstring: > > (setq rmail-remote-password-host "" > rmail-remote-password-user "") > > (defun rmail-get-remote-password (imap user host) > (when (or (not rmail-encoded-remote-password) > (not (equal user rmail-remote-password-user)) > (not (equal host rmail-remote-password-host))) > (setq rmail-remote-password-host host > rmail-remote-password-user user) > (if (not rmail-remote-password) > (setq rmail-remote-password > (let ((found (nth 0 (auth-source-search > :max 1 :user user :host host > :require '(:secret))))) > (if found > (auth-info-password found) > (read-passwd (if imap > "IMAP password: " > "POP password: ")))))) > (rmail-set-remote-password rmail-remote-password) > (setq rmail-remote-password nil)) > (rmail-encode-string rmail-encoded-remote-password (emacs-pid)) > ) Thanks, I've now installed a change along these lines on the master branch, and I'm therefore closing this bug.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.