bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45650: 28.0.50; nnmaildir discards line count


From: Lars Ingebrigtsen
Subject: bug#45650: 28.0.50; nnmaildir discards line count
Date: Mon, 04 Jan 2021 10:44:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Justus-dev@Piater.name writes:

> This code assumes that if no Lines: header is found, mail-header-lines
> returns 0.  However, mail-header-lines returns -1 in this case, causing
> the correctly-counted number of lines in nov-mid to be overwritten with
> -1.
>
> Replacing (zerop field) by (<= field 0) fixes it.
>
> While I think this is indeed a correct immediate fix,

That's a very confusing function, but this does indeed seem to be the
correct fix here, and I've now done as you suggested in Emacs 28.

> this function should be refactored:
>
> - Why count the number of lines in the message only to discard the
>   result if a Lines: header is found afterwards? (Well, fixing this
>   won't have much impact: Of the 161594 messages in my nnmaildir
>   folders, only 2982 contain a Lines: header.)
>
> - [unrelated] Above the quoted code section, the function checks if the
>   NOV data have to be (re)created by parsing the message; if not, it
>   raises an exception to return early.  This construct should be
>   replaced by a conditional, perhaps splitting out the second half into
>   its own function for readability.

Both things seem reasonable, so if somebody wants to do that (or rewrite
that function to be less confusing in general), I'm all for it.  But as
your change fixes this bug, I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]