Balsa 1.4.1 libmutt bug + patch



Hello,

I am attaching a small, 2 line patch (although it took forever to find!) 
that fixes a bug in libmutt.

The bug affects mH and maildir mailbox formats. What was happening was 
that after I installed balsa 1.4.1 all of the messages in my mH mailboxes 
were no longer being marked "read". This caused asmail to report the wrong 
number of unread messages to me.

The problem was that libmutt was never updating the flags when it 
committed mailboxes to disc. So, the "Status", "Lines" and 
"Content-Length" headers would never get written on new mail. Also, if I 
flagged a message, or toggled it back to unread, this state would not get 
saved, which makes sense because these things are written in the headers I 
just mentioned.

So, I found the spot in libmutt, where it decides whether or not to 
rewrite a message, on mailbox close, and there was an overly restrictive 
boolean flag that always prevented messages from being rewritten (unless 
it was deleted).  The trace of this call looks like this:

libbalsa_mailbox_close-> (calls into libmutt)
sync_mailbox->mh_sync_mailbox->mh_sync_message->mh_rewrite_message

This behavior did not exist for mbox mailboxes.  My patch makes mbox and 
mh work the same.

Any comments on this change welcome!

julian
diff -u -r balsa-1.4.1/libmutt/mh.c balsa-1.4.1-patched/libmutt/mh.c
--- balsa-1.4.1/libmutt/mh.c	2002-02-25 07:36:10.000000000 -0800
+++ balsa-1.4.1-patched/libmutt/mh.c	2002-12-13 17:10:46.000000000 -0800
@@ -1095,7 +1095,7 @@
 {
   HEADER *h = ctx->hdrs[msgno];
 
-  if (h->attach_del)
+  if (h->attach_del || h->changed)
     if (mh_rewrite_message (ctx, msgno) != 0)
       return -1;
   
@@ -1106,7 +1106,7 @@
 {
   HEADER *h = ctx->hdrs[msgno];
 
-  if (h->attach_del)
+  if (h->attach_del || h->changed)
   {
     /* when doing attachment deletion, fall back to the MH case. */
     if (mh_rewrite_message (ctx, msgno) != 0)


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