From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.bugs Subject: bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP) Date: Sat, 19 Mar 2022 11:25:28 -0500 Message-ID: <871qyx3o5j.fsf@gnu.org> References: <87tucmc2y4.fsf@gnu.org> <87ee2ya6fz.fsf@ust.hk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4549"; mail-complaints-to="usenet@ciao.gmane.io" To: 54158@debbugs.gnu.org Cancel-Lock: sha1:t3I18v34PSD+fJXF/p9F7rwZZDI= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 19 17:27:17 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 1nVbvB-00011T-BL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Mar 2022 17:27:17 +0100 Original-Received: from localhost ([::1]:34144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVbv9-0006Z2-6o for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Mar 2022 12:27:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVbuw-0006Ym-AI for bug-gnu-emacs@gnu.org; Sat, 19 Mar 2022 12:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVbuw-0001mD-1G for bug-gnu-emacs@gnu.org; Sat, 19 Mar 2022 12:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nVbuv-0005MD-U0 for bug-gnu-emacs@gnu.org; Sat, 19 Mar 2022 12:27:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87tucmc2y4.fsf@gnu.org> Resent-From: Roland Winkler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Mar 2022 16:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54158 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164770719820556 (code B ref -1); Sat, 19 Mar 2022 16:27:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Mar 2022 16:26:38 +0000 Original-Received: from localhost ([127.0.0.1]:60502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVbuX-0005LU-Oq for submit@debbugs.gnu.org; Sat, 19 Mar 2022 12:26:37 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVbuV-0005LJ-Sq for submit@debbugs.gnu.org; Sat, 19 Mar 2022 12:26:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVbuV-0006Wx-Nf for bug-gnu-emacs@gnu.org; Sat, 19 Mar 2022 12:26:35 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:35210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVbuU-0001iJ-CB for bug-gnu-emacs@gnu.org; Sat, 19 Mar 2022 12:26:35 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nVbuR-00008Y-BQ for bug-gnu-emacs@gnu.org; Sat, 19 Mar 2022 17:26:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:228601 Archived-At: 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?