bug in ~/tools/rehash

2010-06-18 Thread Patrick Goetz

Hi -

I'm kicking this patch upstream, as it addresses what seems to be a bug 
in ~/tools/rehash.  See the last patch in the attached file.  I tested 
the perl code just to be sure: all the .$i/$s directories persist after the

  rename (".$i/$s/$t", "$s/$t")
so
  rmdir ".$i" or die "could not remove .$i";
dies.  I'm not sure how this could have ever worked, unless I'm missing 
something...


#! /bin/sh /usr/share/dpatch/dpatch-run
## 40_rehash_fix_pathes.dpatch by Sven Mueller 
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix paths in tools/rehash

@DPATCH@
diff -urNad git~/tools/rehash git/tools/rehash
--- git~/tools/rehash   2010-01-16 19:34:05.100091044 -0200
+++ git/tools/rehash2010-01-16 19:34:05.235091861 -0200
@@ -165,7 +165,7 @@
 $imapdconf = shift || "/etc/imapd.conf";
 
 $yn = "y";
-$sievedir = "/usr/sieve";
+$sievedir = "/var/spool/sieve";
 $nosievedir = 0;
 $hashispool = 0;
 $virtdomains = 0;
@@ -176,7 +176,7 @@
 read_conf($conf);
 }
 
-if (! $confdir) { $confdir = "/var/imap"; }
+if (! $confdir) { $confdir = "/var/lib/cyrus"; }
 
 if ($interactive) {
 print "upgrade $confdir? ";
@@ -550,6 +550,7 @@
  or die "couldn't rename .$i/$s/$t to $s/$t";
  }
  closedir MV;
+ rmdir ".$i/$s" or die "could not remove .$i/$s"
}
closedir SUB;
rmdir ".$i" or die "could not remove .$i";


minor bug in ~/tools/masssievec

2010-06-18 Thread Patrick Goetz

Unused variable in this script (can be dangerous in perl) -- see attached.



#! /bin/sh /usr/share/dpatch/dpatch-run
## 35_masssievec_remove_unused_variable.dpatch by Sven Mueller 

##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Remove the $nosievedir variable which is set once but never used.

@DPATCH@
diff -urNad git~/tools/masssievec git/tools/masssievec
--- git~/tools/masssievec   2010-01-16 19:33:57.355091520 -0200
+++ git/tools/masssievec2010-01-16 19:33:57.482091059 -0200
@@ -84,7 +84,6 @@
push @configs, $1;
}
if (/^sieveusehomedir:\s+(1|t|yes|on)/) {
-   $nosievedir = 1;
print "you are storing sieve scripts in user's home directories, 
this script cannot deal with that\n";
exit;
}


~/tools/undohash

2010-06-18 Thread Patrick Goetz
It seems to me that the header comment indicates that this script 
probably should not be shipping with cyrus 2.x...





~/master/masterconf.c error logging

2010-06-18 Thread Patrick Goetz

I hope you guys aren't getting tired of these bug reports...

The attached patch adds some common sense error logging that probably 
should should have been there in the first place (if we can assume that 
syslog is available).


#! /bin/sh /usr/share/dpatch/dpatch-run
## 21-fix_config-parsing.dpatch by Sven Mueller 
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix parsing of master.conf

@DPATCH@
diff -urNad git~/master/masterconf.c git/master/masterconf.c
--- git~/master/masterconf.c2010-01-16 19:30:00.675090494 -0200
+++ git/master/masterconf.c 2010-01-16 19:30:00.858091347 -0200
@@ -152,8 +152,13 @@
 const char *val = masterconf_getstring(e, key, NULL);
 
 if (!val) return def;
-if (!Uisdigit(*val) && 
-   (*val != '-' || !Uisdigit(val[1]))) return def;
+if (!Uisdigit(*val) &&
+   (*val != '-' || !Uisdigit(val[1]))) {
+   syslog(LOG_DEBUG,
+   "value '%s' for '%s' does not look like a number.",
+   val, key);
+   return def;
+}
 return atoi(val);
 }
 
@@ -171,6 +176,10 @@
 (val[0] == 'o' && val[1] == 'n') || val[0] == 't') {
return 1;
 }
+
+syslog(LOG_DEBUG, "cannot interpret value '%s' for key '%s'. use y/n.",
+  val, key);
+
 return def;
 }