patch for scan cache corruption/staleness

Alexander Zangerl <[email protected]> Sun, 01 Jul 2007 14:01:16 +1000
Newsgroups gmane.mail.exmh.devel
Message-ID <[email protected]>
in my case, every now and then exmh decides to...overlook changes to
folders: i move or delete something, change to another folder and 
then back and...oops, the deleted or moved mail shows up in the 
scan listing *again*. when that happens, folder rescan or changing folders
doesn't help at all; only "update all scan caches" does the job.

i haven't found out what exactly causes the changed state
not to make it into .xmhcache, but i have found and fixed the 
reason why all the safeguards never outdated a stale cache file.

the simple answer: Scan_CacheValid is there but not used and ScanFolder 
blindly assumes that any existing .xmhcache contains goodies.
the fix involves two elements: making sure that the cache is ignored
if it's outdated, and making sure the cache isn't ignored spuriously.

the Scan_CacheValid logic uses the mtime of the directory in question,
but that works only with mh/nmh installations that do not use dotfile-locking
or if the directory in question has no sequences.
this is because the logic in FolderChange makes use of Mh_Folder before
the cache can be checked, and Mh_Folder calls the "folder" program: if 
there are sequences, then folder creates a lockfile in the directory 
in question which makes the directory newer than the cache. 

so, if we don't run Mh_Folder, the cache validity decision 
can be made correctly. i've looked at the code in question for quite 
some time and decided to simply get rid of the Mh_Folder call, which
sets a summary which is then used by Label_Folder: for some reason that
i chose not to hunt down, Label_Folder works just as well when you
don't feed it a summary. i haven't observed any side effects of this
change.

a patch against 2.7.2 is attached; if somebody would please apply
that in the CVS i'd be grateful. (the debian port of exmh will have 
that patch in version 2.7.2-11.)

regards
az

-- 
+ Alexander Zangerl + DSA 42BD645D + (RSA 5B586291)
Things should be as simple as possible, but not simpler. -- Albert Einstein

_______________________________________________
Exmh-workers mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/exmh-workers
09_scancache.dpatch (application/x-shellscript, 2.4 KB) - not displayed
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGhycbpy/2bEK9ZF0RAicHAKCQ+cVGq3+OOWM7ypaBk2HJss5RBACbBsuZ
A2qd7yAzFS1bsi0N+JPVHkU=
=KE3W
-----END PGP SIGNATURE-----