exmh (1:2.7.2-24) 09_scancache

Summary

 lib/folder.tcl |    5 +----
 lib/scan.tcl   |    8 +++++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

    
download this patch

Patch contents

#! /bin/sh /usr/share/dpatch/dpatch-run
## 09_scancache.dpatch by  <az@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: fix the stale scan cache problem

@DPATCH@
diff -urNad exmh-2.7.2~/lib/folder.tcl exmh-2.7.2/lib/folder.tcl
--- exmh-2.7.2~/lib/folder.tcl	2007-07-01 13:59:08.000000000 +1000
+++ exmh-2.7.2/lib/folder.tcl	2007-07-01 13:59:08.000000000 +1000
@@ -97,15 +97,12 @@
     set msg(id) ""
     if {$folder != $exmh(folder)} {
 	Exmh_Debug Exmh_CheckPoint [time Exmh_CheckPoint]
-	global mhProfile
-	set summary [Mh_Folder $folder]	;# Set MH folder state
     } else {
 	if {$ftoc(folder) == {} && $exmh(started)} {
 	    # pseudo-display -> Checkpoint to set cur msg
 	    # startup -> don't checkpoint (clears cur sequence)
 	    Exmh_Debug Exmh_CheckPoint [time Exmh_CheckPoint]
         }
-	set summary {}
     }
     set ftoc(displayValid) 1
     set exmh(started) 1
@@ -113,7 +110,7 @@
     if [info exists folderHook(leave,$oldFolder)] {
 	$folderHook(leave,$oldFolder) $oldFolder leave
     }
-    Label_Folder $folder $summary
+    Label_Folder $folder
     Fdisp_HighlightCur $folder
     Flist_Visited $folder
     set exmh(folder) $folder
diff -urNad exmh-2.7.2~/lib/scan.tcl exmh-2.7.2/lib/scan.tcl
--- exmh-2.7.2~/lib/scan.tcl	2004-07-27 04:23:33.000000000 +1000
+++ exmh-2.7.2/lib/scan.tcl	2007-07-01 13:59:43.000000000 +1000
@@ -28,7 +28,7 @@
     } else {
 	set samefolder 0
 	set cacheFile $mhProfile(path)/$folder/.xmhcache
-	if [catch {open $cacheFile} input] {
+	if {! [Scan_CacheValid $folder] || [catch {open $cacheFile} input]} {
 	    # No cache, scan last N messages
 	    Exmh_Status "Limit scan $folder last:$ftoc(scanSize) - Rescan?" warn
 	    set input  [open "|$mhProfile(scan-proc) [list +$folder] \
@@ -240,10 +240,16 @@
     global mhProfile exmh
     set cacheFile $mhProfile(path)/$folder/.xmhcache
     if {![file exists $cacheFile] || ![file size $cacheFile]} {
+	Exmh_Debug No/empty scan cache for +$folder
 	return 0
     }
+    # note that nmh's folder command produces lockfiles 
+    # in the respective directory, which means the directory modification date 
+    # will be changed and cause a false "cache invalid" decision
+    # if folder is run before Scan_CacheUpdate on folder entry
     if {[file mtime $mhProfile(path)/$folder] >
 	[file mtime $cacheFile]} {
+	Exmh_Debug Outdated scan cache for +$folder
 	return 0
     }
     return 1