John Lightsey
2008-Sep-19 15:05 UTC
[Dovecot] Bug in keywords conversion with courier-dovecot-migrate.pl v1.1.7
The problem is the file glob on line 344 in convert_subscriptions() # read updates from the directory my %updates; foreach (<$keyword_dir/*>) { This isn't going to pick up any files beginning with a dot, so most of the update files in the courierimapkeywords directory are going to be skipped.
Timo Sirainen
2008-Sep-19 15:26 UTC
[Dovecot] Bug in keywords conversion with courier-dovecot-migrate.pl v1.1.7
On Sep 19, 2008, at 6:05 PM, John Lightsey wrote:> The problem is the file glob on line 344 in convert_subscriptions() > > # read updates from the directory > my %updates; > foreach (<$keyword_dir/*>) { > > This isn't going to pick up any files beginning with a dot, so most > of the update files in the courierimapkeywords directory are going > to be skipped.Any suggestions how to best fix it? My Perl knowledge isn't too good. -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20080919/4db4effa/attachment-0002.bin>
Steffen Kaiser
2008-Sep-22 09:02 UTC
[Dovecot] Bug in keywords conversion with courier-dovecot-migrate.pl v1.1.7
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 19 Sep 2008, Timo Sirainen wrote:> Any suggestions how to best fix it? My Perl knowledge isn't too good. >I do recommend using opendir() cycle like so: - --- /tmp/courier-dovecot-migrate.pl.orig 2008-09-22 10:55:00.000000000 +0200 +++ /tmp/courier-dovecot-migrate.pl 2008-09-22 11:00:19.000000000 +0200 @@ -341,12 +341,10 @@ # read updates from the directory my %updates; - - foreach (<$keyword_dir/*>) { - - s,^$keyword_dir/,,; - - next if ($_ eq ":list"); - - - - my $fname = $_; - - if (/^\.(\d+)\.(.*)$/) { + if(opendir(DIR, $keyword_dir)) { + while(defined (my $fname = readdir(DIR))) { + next if $fname eq ':list'; + if ($fname =~ /^\.(\d+)\.(.*)$/) { my ($num, $base_fname) = ($1, $2); if (!defined $updates{$fname}) { $updates{$fname} = $num; @@ -361,6 +359,10 @@ $updates{$fname} = -1; } } + closedir DIR or die "Failed reading $keyword_dir: $!\n"; + } else { + die "Failed opening $keyword_dir: $!\n"; + } # apply the updates foreach (keys %updates) { - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFI118/VJMDrex4hCIRArglAJ9K+wkb2pOVDBEATCxTFylX5HhsMQCg1VzP W9NSzDI55wNDZqGRgK6GXVw=YwiS -----END PGP SIGNATURE-----