Subject: bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP)

From: Roland Winkler <[email-masked]>
Date: Fri, 25 Feb 2022 10:42:59 -0600

I have not been able to get to the root of the following problem.  Yet I
thought I post it anyway as it is rather annoying.

I am fairly new to Gnus when I first used it with Emacs 27 (for about
half a year).  Since Emacs 28.0.91 came out, I have been using it and
this gives me the strange problem that Gnus downloads some mail messages
from the IMAP server multiple times without deleting them on the server
(typically three to five times) till Gnus (or the IMAP server?) decides
it has downloaded this message often enough.  These messages are marked
in Gnus as duplicates of the first instance of this message.  Yet
stranger, it only happens with spam emails including many emails that
are not marked as spam by the spam filter of the IMAP server.  But only
when I look into these emails I see that I do not want or need them.

First, I thought that something had changed on the IMAP server
(Office 365) that triggered this.  Then I switched back from Emacs
28.0.91 to Emacs 27.2, when the problem disappeared again.  Then I went
back to 28.0.91, when I am annoyed again by these duplicate messages.
So from all I can tell, it appears to be related to some difference
between how Emacs 27 and 28.0.91 fetch mail from the IMAP server.

Is anybody else seeing something similar?  Let me know what kind of
details might help to debug this further.  (I am not yet a Gnus expert
and yet less an expert of the IMAP protocol that may also play a role
here.)

In GNU Emacs 28.0.91 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2022-01-16 built on regnitz
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Configured using:
 'configure --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix