Cyrus IMAP 2.4.14 released
Carlos Velasco
carlos.velasco at nimastelecom.com
Wed Mar 14 14:50:26 EDT 2012
Looking into Imap util.c code I saw that names are stopped at a "." for
the hash function and this is not in the rehash utility, so I patched a
bit again the tool and now it works as expected.
Here is my patch:
--- cyrus-imapd-2.4.14/tools/rehash 2012-03-12 12:47:51.000000000 +0100
+++ cyrus-imapd-2.4.14.patched/tools/rehash 2012-03-14
19:41:51.076296523 +0100
@@ -127,10 +127,12 @@
my $name = shift;
my $uint32 = (2**32);
my ($h, $n);
+ my $stname;
if ($tofull) {
+ ($stname) = split(/\./, $name);
$n = 0;
- foreach my $b (split(/ */, $name)) {
+ foreach my $b (split(//, $stname)) {
$n = ((($n << 3) ^ ($n >> 5)) % $uint32) ^ ord($b);
}
$h = chr(ord('A') + ($n % 23));
@@ -146,10 +148,12 @@
sub dir_hash_c_64 {
my $name = shift;
my ($h, $n);
+ my $stname;
if ($tofull) {
+ ($stname) = split(/\./, $name);
$n = Math::BigInt->new(0);
- foreach my $b (split(/ */, $name)) {
+ foreach my $b (split(//, $stname)) {
$n = (($n << 3) ^ ($n >> 5)) ^ ord($b);
}
$h = chr(ord('A') + ($n % 23));
@@ -194,7 +198,7 @@
$sievedir = $1;
print "you are using $sievedir as your sieve directory.\n";
}
- if (/^virtdomains:\s+(1|t|yes|on)/) {
+ if (/^virtdomains:\s+(1|t|yes|on|userid)/) {
$virtdomains = 1;
print "i will deal with virtual domains.\n";
}
@@ -344,8 +348,8 @@
}
unless ($tonone) {
foreach $i (@{$old}) {
- if (opendir SUB, $i) {
- while ($s = readdir SUB) {
+ if (opendir SUBMVDM, $i) {
+ while ($s = readdir SUBMVDM) {
if ($s =~ /^\./s) { next; }
chdir "$i/$s";
@@ -372,7 +376,7 @@
rename ("$h_32/$s", "$h_64/$s") or ouch
"couldn't move $s back!";
}
}
- closedir SUB;
+ closedir SUBMVDM;
rmdir "$i" or die "couldn't remove $i";
}
}
-------- Original Message --------
Subject: Re: Cyrus IMAP 2.4.14 released
From: Carlos Velasco <carlos.velasco at nimastelecom.com>
To: info-cyrus at lists.andrew.cmu.edu
Cc: cyrus-devel at lists.andrew.cmu.edu
Date: Wed Mar 14 2012 19:13:43 GMT+0100
> In a Linux LFS Pure 64 (no 32 libs) upgrading from 2.4.13 to 2.4.14 with
> fulldirhash: 1 and hashimapspool: 1 trigger the "System I/O error".
>
> If I am right, previous to the long long patch this system was hashed in
> 32 and now in 2.4.14 it is looking for indexes in hash64.
>
> So I tried to use rehash to convert to basic and then to full to
> recreate in hash64.
> First I had to patch the rehash tool a bit as it was lacking virtdomains
> switch "userid" and also there was a reutilization of the SUB opendir
> handle leading to nasty "invalid dirhandle" errors.
>
> But the real problem is that hashing of "rehash" utility does not match
> the used in cyrus imap.
>
> Rehash:
> domain moving k/kaka.com to N/kaka.com
> moving n/newipnet.com to T/newipnet.com
> moving n/nimastelecom.com to G/nimastelecom.com
> moving p/prueba.com to T/prueba.com
>
> Cyrus imap 2.4.14:
> open("/imap/part1/domain/S/nimastelecom.com/C/user/carlos^velasco/cyrus.index",
> O_RDWR) = -1 ENOENT (No such file or directory)
> open("/imap/part1/domain/U/newipnet.com/C/user/carlos^velasco/cyrus.index",
> O_RDWR) = -1 ENOENT (No such file or directory)
>
> Using the formula in rehash utility:
> ===
> require Math::BigInt;
>
> my $name = "newipnet.com";
>
> $n = Math::BigInt->new(0);
> foreach my $b (split(/ */, $name)) {
> $n = (($n << 3) ^ ($n >> 5)) ^ ord($b);
> }
> $h = chr(ord('A') + ($n % 23));
> print $h;
> ===
> Output: T
>
> But Cyrus Imap 2.4.14 is trying to get it into U in my case.
>
> So, I think rehash utility is broken really.
>
>
> --- cyrus-imapd-2.4.14/tools/rehash 2012-03-12 12:47:51.000000000 +0100
> +++ cyrus-imapd-2.4.14.patched/tools/rehash 2012-03-14
> 18:59:20.001558956 +0100
> @@ -194,7 +194,7 @@
> $sievedir = $1;
> print "you are using $sievedir as your sieve directory.\n";
> }
> - if (/^virtdomains:\s+(1|t|yes|on)/) {
> + if (/^virtdomains:\s+(1|t|yes|on|userid)/) {
> $virtdomains = 1;
> print "i will deal with virtual domains.\n";
> }
> @@ -344,8 +344,8 @@
> }
> unless ($tonone) {
> foreach $i (@{$old}) {
> - if (opendir SUB, $i) {
> - while ($s = readdir SUB) {
> + if (opendir SUBMVDM, $i) {
> + while ($s = readdir SUBMVDM) {
> if ($s =~ /^\./s) { next; }
>
> chdir "$i/$s";
> @@ -372,7 +372,7 @@
> rename ("$h_32/$s", "$h_64/$s") or ouch
> "couldn't move $s back!";
> }
> }
> - closedir SUB;
> + closedir SUBMVDM;
> rmdir "$i" or die "couldn't remove $i";
> }
> }
>
More information about the Info-cyrus
mailing list