Subject: 27.0.50; Gnus (nnimap) shows "ghost" messages in summary buffer
From: Ulrich Mueller <[email-masked]>
To: [email-masked]
Date: Sat, 27 Apr 2019 08:23:03 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit)
 of 2019-04-21 built on a1i15
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description: Gentoo/Linux

When fetching e-mail from a dovecot-2.3.5.1 IMAP server, Gnus/nnimap
gets confused and displays ghost messages with address "nobody" and
subject "(none)" in the summary buffer, like in this example:

*Summary nnimap+dev.gentoo.org:INBOX*
----------------------------------------------------------------------
R. [   1: Ulrich Mueller         ] test 1
 . [   ?: nobody                 ] (none)
 . [   1: Ulrich Mueller         ] test 2
----------------------------------------------------------------------

My gnus-secondary-select-methods looks like this:

      '((nnimap "dev.gentoo.org"
		(nnimap-stream tls)
		(nnimap-user "ulm"))
	;; ... further methods omitted ...
	)

For debugging, I have enabled logging with nnimap-record-commands, and
set debug-on-entry for function nnimap-transform-headers.

I then get the following "*imap log*" buffer:
----------------------------------------------------------------------
07:41:57 [dev.gentoo.org] (inhibited)
07:41:59 [dev.gentoo.org] 10105 CAPABILITY
07:41:59 [dev.gentoo.org] 10106 ENABLE QRESYNC
07:41:59 [dev.gentoo.org] 10107 LIST "" "*"
[... other servers ...]
07:42:00 [dev.gentoo.org] 10147 EXAMINE "INBOX" (QRESYNC (1364468255 63360))
[... other servers ...]
07:42:08 [dev.gentoo.org] 10192 SELECT "INBOX"
07:42:08 [dev.gentoo.org] 10193 SELECT "INBOX"
07:42:08 [dev.gentoo.org] 10194 UID FETCH 32409:32410 (UID RFC822.SIZE BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (Subject From Date Message-Id References In-Reply-To Xref X-Diary-Time-Zone X-Diary-Dow X-Diary-Year X-Diary-Month X-Diary-Dom X-Diary-Hour X-Diary-Minute To Newsgroups Cc)])
----------------------------------------------------------------------

Buffer " *nnimap dev.gentoo.org nil  *nntpd**" looks like this, upon
entering nnimap-transform-headers:
----------------------------------------------------------------------
* 583 FETCH (UID 32409 RFC822.SIZE 698 BODYSTRUCTURE ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 8 1 NIL NIL NIL NIL) BODY[HEADER.FIELDS (SUBJECT FROM DATE MESSAGE-ID REFERENCES IN-REPLY-TO XREF X-DIARY-TIME-ZONE X-DIARY-DOW X-DIARY-YEAR X-DIARY-MONTH X-DIARY-DOM X-DIARY-HOUR X-DIARY-MINUTE TO NEWSGROUPS CC)] {165}
From: Ulrich Mueller <[email-masked]>
To: [email-masked]
Subject: test 1
Date: Sat, 27 Apr 2019 07:39:56 +0200
Message-ID: <[email-masked]>

)
* 584 FETCH (UID 32410 RFC822.SIZE 698 BODYSTRUCTURE ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 8 1 NIL NIL NIL NIL) BODY[HEADER.FIELDS (SUBJECT FROM DATE MESSAGE-ID REFERENCES IN-REPLY-TO XREF X-DIARY-TIME-ZONE X-DIARY-DOW X-DIARY-YEAR X-DIARY-MONTH X-DIARY-DOM X-DIARY-HOUR X-DIARY-MINUTE TO NEWSGROUPS CC)] {165}
From: Ulrich Mueller <[email-masked]>
To: [email-masked]
Subject: test 2
Date: Sat, 27 Apr 2019 07:40:15 +0200
Message-ID: <[email-masked]>

)
* 583 FETCH (UID 32409 MODSEQ (63364) FLAGS ($HasNoAttachment))
* 584 FETCH (UID 32410 MODSEQ (63364) FLAGS ($HasNoAttachment))
10194 OK Fetch completed (0.003 + 0.000 + 0.002 secs).
----------------------------------------------------------------------