From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP) Date: Mon, 21 Mar 2022 12:33:49 -0700 Message-ID: <87lex3ksma.fsf@ericabrahamsen.net> References: <87tucmc2y4.fsf@gnu.org> <87ee2ya6fz.fsf@ust.hk> <871qyx3o5j.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17224"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 54158@debbugs.gnu.org To: Roland Winkler , Andrew Cohen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 21 20:34:10 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWNn7-0004Dh-RE for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Mar 2022 20:34:09 +0100 Original-Received: from localhost ([::1]:46316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWNn6-0001xF-Gn for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Mar 2022 15:34:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWNn0-0001x6-MR for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 15:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWNn0-000063-EJ for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 15:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWNn0-0005pH-Bt for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2022 15:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Mar 2022 19:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54158 X-GNU-PR-Package: emacs Original-Received: via spool by 54158-submit@debbugs.gnu.org id=B54158.164789123922385 (code B ref 54158); Mon, 21 Mar 2022 19:34:02 +0000 Original-Received: (at 54158) by debbugs.gnu.org; 21 Mar 2022 19:33:59 +0000 Original-Received: from localhost ([127.0.0.1]:38358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWNmx-0005oz-2N for submit@debbugs.gnu.org; Mon, 21 Mar 2022 15:33:59 -0400 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:59986) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWNmv-0005ol-2v for 54158@debbugs.gnu.org; Mon, 21 Mar 2022 15:33:57 -0400 Original-Received: from localhost (c-71-197-232-41.hsd1.wa.comcast.net [71.197.232.41]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id AEECAFA0B2; Mon, 21 Mar 2022 19:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1647891231; bh=iR5P5bJIWyIuX4bicDQpiFwhvXCdwqgL8IP8DWnE88s=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=BQjnE33waCUnqW3dDzKF1ewudGxReVKdEPuNnwhZ7YQjppJIefFLa/C8KVDNHiVxZ Jg68nXf8wK0+4VG0iBUJnCiryOgEe9sad9UlRMX9OMGzbFCG/Ym5Zl6kgA+0QEOHtq 6BklYei2Xb1w7aRB6ZDtqsGRWB4BQTy3ibnLvdMY= In-Reply-To: <871qyx3o5j.fsf@gnu.org> (Roland Winkler's message of "Sat, 19 Mar 2022 11:25:28 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:228715 Archived-At: Roland Winkler 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.