Author: Alexander Zangerl <az@debian.org>
Subject: upstream patches from cvs, scan.tcl: consistent permissions on .xmhcache, source.tcl: fix for incorrect option handling for source()

diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' exmh-2.8.0~/lib/scan.tcl exmh-2.8.0/lib/scan.tcl
--- exmh-2.8.0~/lib/scan.tcl	2012-04-22 14:02:56.000000000 +1000
+++ exmh-2.8.0/lib/scan.tcl	2013-09-11 22:31:17.544955566 +1000
@@ -274,14 +274,14 @@
 	set curLine [Ftoc_ClearCurrent]			;# Clear +
         if [file writable $cacheFile] {
             set scancmd "exec $mhProfile(scan-proc) [list +$folder] \
-		    -width $ftoc(scanWidth) -noheader > [list $cacheFile]"
+		    -width $ftoc(scanWidth) -noheader >@ [open $cacheFile w 0$mhProfile(msg-protect)]"
             if [catch $scancmd err] {
                 Exmh_Status "failed to rescan folder $folder: $err" warn
             }
         }
 	Ftoc_Change $curLine	;# Restore it
     } elseif [catch {
-	set cacheIO [open $cacheFile w]
+	set cacheIO [open $cacheFile w 0$mhProfile(msg-protect)]
 	set curLine [Ftoc_ClearCurrent]			;# Clear +
 	set display [$exwin(ftext) get 1.0 "end -1 char"]
 	Ftoc_Change $curLine	;# Restore it
@@ -309,7 +309,7 @@
     }
     set len [string length $prefix]
     set fmt [format "%%%dd%%s" $len]
-    set cacheIO [open $cacheFile a]
+    set cacheIO [open $cacheFile a 0$mhProfile(msg-protect)]
     for {set i [expr [llength $scanlinesR]-1]} {$i >= 0} {incr i -1} {
 	set line [lindex $scanlinesR $i]
 	if [regsub {( *[0-9]+)(\+)} $line {\1 } newline] {
@@ -338,7 +338,7 @@
 	if {$force || ! [Scan_CacheValid $f]} {
 	    puts $out "catch \{send $myname \{Exmh_Status \"scan +$f\"\}\}"
 	    puts $out "catch {
-		set out \[open $mhProfile(path)/$f/.xmhcache w $mhProfile(msg-protect)\]
+		set out \[open $mhProfile(path)/$f/.xmhcache w 0$mhProfile(msg-protect)\]
 		exec $mhProfile(scan-proc) +$f -width $ftoc(scanWidth) -noheader >@\$out
 		close \$out
 	    }"
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' exmh-2.8.0~/lib/source.tcl exmh-2.8.0/lib/source.tcl
--- exmh-2.8.0~/lib/source.tcl	2012-04-22 14:02:56.000000000 +1000
+++ exmh-2.8.0/lib/source.tcl	2013-09-11 22:31:38.527841230 +1000
@@ -1,9 +1,9 @@
 if {$exmh(sourceHook) && [info command source-orig] ==  ""} {
     rename source source-orig
-    proc source {file} {
+    proc source {args} {
 	 global SourceHook
-	 set result [uplevel 1 [list source-orig $file]]
-	 set fn [file rootname [file tail $file]]
+	 set result [uplevel 1 "source-orig $args"]]
+	 set fn [file rootname [file tail [lindex $args end]]]
 	 if [info exists SourceHook($fn)] {
 	    if [catch {uplevel 1 $SourceHook($fn)} err] {
 		Exmh_Status "Error in source hook for $fn: $err" warning
