unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Cohen <acohen@ust.hk>
To: 54158@debbugs.gnu.org
Subject: bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP)
Date: Sat, 19 Mar 2022 12:53:52 +0800	[thread overview]
Message-ID: <87ee2ya6fz.fsf@ust.hk> (raw)
In-Reply-To: <87tucmc2y4.fsf@gnu.org>

(I sent this to Roland directly since I'm a bit shy about communicating
on public lists, but here goes anyway)

I think the problem is that the code in mail-source-fetch-imap doesn't
handle a list of mailboxes properly (I don't know why it would have
worked in emacs-27 though). Adam added a loop over a list of mailboxes
way back in 2015, but it seems to me that some of the variables bound
outside the loop should be bound inside (imap usually works on a per
mailbox basis)

So I think this might fix it (although I don't have a setup available to
test it).

Of course I might be totally off-base. If so, sorry in advance. 

diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 5d0c0e2654..01cca831f2 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -1066,9 +1066,7 @@ mail-source-fetch-imap
     (let ((from (format "%s:%s:%s" server user port))
 	  (found 0)
 	  (buf (generate-new-buffer " *imap source*"))
-	  (mail-source-string (format "imap:%s:%s" server mailbox))
-	  (imap-shell-program (or (list program) imap-shell-program))
-	  remove)
+	  (imap-shell-program (or (list program) imap-shell-program)))
       (if (and (imap-open server port stream authentication buf)
 	       (imap-authenticate
 		user (or (cdr (assoc from mail-source-password-cache))
@@ -1078,7 +1076,8 @@ mail-source-fetch-imap
             (dolist (mailbox mailbox-list)
               (when (imap-mailbox-select mailbox nil buf)
 	  (let ((coding-system-for-write mail-source-imap-file-coding-system)
-		str)
+                (mail-source-string (format "imap:%s:%s" server mailbox))
+		str remove)
             (message "Fetching from %s..." mailbox)
 	    (with-temp-file mail-source-crash-box
 	      ;; Avoid converting 8-bit chars from inserted strings to


-- 
Andrew Cohen





  parent reply	other threads:[~2022-03-19  4:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 16:42 bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP) Roland Winkler
2022-02-25 21:05 ` Eric Abrahamsen
2022-02-25 21:36   ` Roland Winkler
2022-02-26  5:19     ` Eric Abrahamsen
2022-02-28 16:30       ` Roland Winkler
2022-03-07 15:50       ` Roland Winkler
2022-03-10 19:38         ` Eric Abrahamsen
2022-03-13  5:33           ` Roland Winkler
2022-03-18 16:09             ` Roland Winkler
2022-03-18 16:19               ` Eric Abrahamsen
2022-03-18 16:34                 ` Roland Winkler
2022-03-18 16:45                   ` Robert Pluim
2022-03-18 17:55                     ` Roland Winkler
2022-03-18 16:49                   ` Eric Abrahamsen
2022-03-18 16:53                     ` Eric Abrahamsen
2022-03-18 15:27       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-18 16:03         ` Eric Abrahamsen
2022-03-19  4:53 ` Andrew Cohen [this message]
2022-03-19 16:25   ` Roland Winkler
2022-03-21 19:33     ` Eric Abrahamsen
2022-03-21 19:38       ` Lars Ingebrigtsen
2022-03-21 19:48         ` Eric Abrahamsen
2022-03-21 19:50           ` Lars Ingebrigtsen
2022-03-21 23:18             ` Eric Abrahamsen
2022-03-21 20:40       ` Roland Winkler
2022-03-21 23:27         ` Eric Abrahamsen
2022-03-19 21:52 ` Andrew Cohen
2022-03-20  3:50   ` Roland Winkler

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=87ee2ya6fz.fsf@ust.hk \
    --to=acohen@ust.hk \
    --cc=54158@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).