GNU bug report logs -
#50450
28.0.50; nnmaildir cannot find article file
Previous Next
Reported by: Philip Kaludercic <philipk <at> posteo.net>
Date: Tue, 7 Sep 2021 08:23:02 UTC
Severity: normal
Found in version 28.0.50
Done: Philip Kaludercic <philipk <at> posteo.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Philip Kaludercic <philipk <at> posteo.net> writes:
>
>>From time to time I get error messages like
>>
>> nnmaildir--article-set-flags: Couldn’t find article file
>> /home/philip/Mail/Pers/Sent/cur/1631002186.M670797P704685Q0.icterid:2,S
>>
>> when trying to send a message.
>
> I don't use nnmaildir myself (and I'm not familiar with how maildir
> works, really). Can you propose a patch to fix this yourself? :-)
I found out that the issue is not the UID, but the flags. Specifically,
when I open a message via Gnus, leave it open for a while, perhaps check
the message on my phone or some other device, and then return to Gnus,
it might have happened that the flags (included in the file-name) were
updated by mbsync.
This patch attempts to find a similar file, and renames that file
instead of the one Gnus remembered. It seems to be working for now, but
I'd wait a bit until I had more time to test it before applying it:
[0001-Handle-updates-flags-when-setting-flags.patch (text/x-diff, inline)]
From facb1848952d5c844d76844e35da708fda8307c7 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk <at> posteo.net>
Date: Wed, 15 Sep 2021 10:58:50 +0200
Subject: [PATCH] Handle updates flags when setting flags
* nnmaildir.el (nnmaildir--article-set-flags): Handle updated flags
more gracefully
---
lisp/gnus/nnmaildir.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 171f0813b3..690761a2d6 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -194,7 +194,15 @@ nnmaildir--article-set-flags
(article-file (concat curdir prefix suffix))
(new-name (concat curdir prefix new-suffix)))
(unless (file-exists-p article-file)
- (error "Couldn't find article file %s" article-file))
+ (let ((possible (file-expand-wildcards (concat curdir prefix "*"))))
+ (cond ((length= possible 1)
+ (unless (string-match-p "\\`\\(.+\\):2,.*?\\'" (car possible))
+ (error "Couldn't find updated article file %s" article-file))
+ (setq article-file (car possible)))
+ ((length> possible 1)
+ (error "Couldn't determine exact article file %s" article-file))
+ ((null possible)
+ (error "Couldn't find article file %s" article-file)))))
(rename-file article-file new-name 'replace)
(setf (nnmaildir--art-suffix article) new-suffix)))
--
2.30.2
[Message part 3 (text/plain, inline)]
One possible issue is that nnmaildir--article-set-flags overwrites
previous flags that might have been updated elsewhere.
--
Philip Kaludercic
This bug report was last modified 3 years and 302 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.