<<< Date Index >>>     <<< Thread Index >>>

hcache broken (slightly)



Hi,

as discussed previously, Brendan and me have problems with repeatedly storing headers in the hcache resulting in corruption.

The only example I can provide is the attached tiny patch now that the POP caching is in CVS.

The crash appears in the sorting code with totally bogus values. If I put a hcache_delete() before it, just the place of the crash changes. I use qdbm and can reproduce it.

Note that I double-checked by rebuilding the POP hcache for that mailbox completely.

One reason could be the way data is stored: it's just a memcpy of the HEADER* structure with pointers and such. However, when we first fetch a header, it doesn't have the full information like pointers set up for sorting etc. Maybe that could be the reason?

I ask for other ideas before I try to zero them out in hcache.c after fetching a header.

  bye, Rocco
--
:wq!
diff --git a/main.c b/main.c
diff --git a/mutt_curses.h b/mutt_curses.h
diff --git a/pop.c b/pop.c
index 72925c7..66a83d5 100644
--- a/pop.c
+++ b/pop.c
@@ -625,6 +625,10 @@ #if USE_HCACHE
 #endif
        }
       }
+#if USE_HCACHE
+      if (ctx->hdrs[i]->changed)
+       mutt_hcache_store (hc, ctx->hdrs[i]->data, ctx->hdrs[i], 0, strlen);
+#endif
     }
 
 #if USE_HCACHE