GNU bug report logs - #54158
28.0.91; duplicate mail downloads in Gnus (IMAP)

Previous Next

Package: emacs;

Reported by: Roland Winkler <winkler <at> gnu.org>

Date: Fri, 25 Feb 2022 16:44:01 UTC

Severity: normal

Found in version 28.0.91

Fixed in version 29.1

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

Bug is archived. No further changes may be made.

Full log


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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Roland Winkler <winkler <at> gnu.org>,
    Andrew Cohen <acohen <at> ust.hk>
Cc: 54158 <at> debbugs.gnu.org
Subject: Re: bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP)
Date: Mon, 21 Mar 2022 12:33:49 -0700
Roland Winkler <winkler <at> gnu.org> writes:

> On Sat, Mar 19 2022, Andrew Cohen wrote:
>> 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).
>
> Thank you!  I can confirm: I identified one scenario with emails I send
> to myself such that they go into different folders on the IMAP server.
> Then downloading these messages with Gnus from Emacs 28.0.91 gives me
> reproducibly the duplicate mail downloads as described in the original
> post.  When I apply Andrew's patch to `mail-source-fetch-imap' the
> downloads happen as expected, properly deleting the messages on the
> server after download, as confirmed also with imap-log bound to to.
> So for this one test case the patch appears to solve the problem.
>
> The patch may require more testing and also checking the code by someone
> who knows what is supposed to happen in such an imap session.  I am
> surprised that `mail-source-fetch-imap' in Gnus from Emacs 27.2 and from
> Emacs 28.0.91 are essentially the same (from all I can tell).  So I am
> wondering why `mail-source-fetch-imap' in Gnus from Emacs 27.2 was
> behaving as expected; but the bug showed up only in Emacs 28.  Can this
> be in subtle ways related to the fact that mail-source.el in Emacs 27
> used dynamic binding, whereas in Emacs 28 it uses lexical binding, as
> speculated previously by Eric?

FWIW this patch looks right to me, thanks to Andy for figuring it out.
Is someone going to push this? It would be nice at the same time to fix
the indentation of the mailbox loop so it's clearer what's actually
happening.




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

Previous Next


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