ctx->vsize reset
Vincent Lefevre
vincent at vinc17.org
Tue Jul 24 02:47:43 UTC 2018
On 2018-07-22 09:54:44 -0700, Kevin J. McCarthy wrote:
> On Sun, Jul 22, 2018 at 03:35:38AM +0200, Vincent Lefevre wrote:
> > I'm wondering whether there could be similar bugs in other parts
> > of the code, where vcount is reset to 0, but not vsize.
>
> Nice sleuthing!
>
> > mbox.c has:
> > [...]
> > but nothing related to vsize.
>
> Since this is a reset (reopen), I think you're right, and vsize should
> be cleared here too.
Done. I could check that the old value is at least obsolete.
It is not clear whether this is useful, but at least, if there is a
bug somewhere else, it will be easier to notice it. For instance,
if vsize is not recomputed at some place, I suppose that one will
get 0 instead of a wrong value that could remained unnoticed.
> > sort.c has "ctx->vcount = 0;" twice, but nothing about vsize.
> >
> > I don't know whether this is correct.
>
> The first time, I'm not sure about, but since ctx->msgcount is 0, it
> would seem safe to reset vsize too.
Done too as this is safier.
> I think the second time is okay. The routine is just resorting, and
> updating the virtual and v2r fields with the assumption that the actual
> visible headers hasn't changed.
mutt_sort_headers can be called in mbox_sync_mailbox after the
mailbox has been reopened:
if (need_sort)
/* if the mailbox was reopened, the thread tree will be invalid so make
* sure to start threading from scratch. */
mutt_sort_headers (ctx, (need_sort == MUTT_REOPENED));
Before the call to mutt_sort_headers, the vsize value is incorrect
(obsolete). After the call, if the sort method is not by thread,
then it is still incorrect. The new value will be computed later,
but I think that vcount and vsize should be set to 0 as soon as
the old values become obsolete. But this would be at another place
in the code.
While testing, I've noticed an unrelated bug:
---Mutt: =test2 [Msg:46/46 Inc:10 202K/203K]---(date)---------------------(end)-
All messages are visible in the limited view, but vsize is different
from the full size. This is not consistent. This happens when starting
Mutt on this mailbox and selecting a limited view.
--
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the Mutt-dev
mailing list