Hello,

Andy Fiddaman wrote:
I've just migrated my metadata files to a separate partition on faster
disks and had a problem with the migrate-metadata script. I use
virtdomains and when the script processes directories it skips any
containing a dot. Since all of my domain directories contain a dot, none
of them were processed.

I made this change to get it to work (this is with 2.3.9), it could be
done in one match, this was just a quick fix.

--- cyrus-imapd-2.3.9/tools/migrate-metadata    2006-11-30
17:11:25.000000000 +0000
+++ cyrus-imapd-2.3.9/tools/migrate-metadata.new        2007-10-05
14:06:54.842848647 +0000
@@ -160,7 +160,7 @@
          ouch "couldn't delete $part$subpath";
        }
    }
-   elsif ($subdir =~ /^[^\.]+$/s) {
+   elsif (-d "$part$subpath" && $subdir !~ /^./ && $subdir !~ /\.$/) {
I tried your patch and it doesn't really recurse here.  It does recurse 
if I match on subdir !~ /^\./  You are matching on every character at 
the beginning of the line.
An other problem is that it copies other directories too, depending on 
what your are matching.  (That is not your fault ) E.g.  The socket 
directory where the lmtp socket resides.
It think it is difficult to make a definite list of al case, depending 
if one is using virtual domains, what seperator, ...
I've attached a patch that solves my case :)


--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Rudy Gevaert          [EMAIL PROTECTED]          tel:+32 9 264 4734
Directie ICT, afd. Infrastructuur ICT Department, Infrastructure office
Groep Systemen                    Systems group
Universiteit Gent                 Ghent University
Krijgslaan 281, gebouw S9, 9000 Gent, Belgie               www.UGent.be
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--- cyrus-imapd-2.3.7/tools/migrate-metadata    2005-12-01 23:30:22.000000000 
+0100
+++ cyrus-imapd-2.3.7/tools/migrate-metadata.new        2007-10-08 
16:15:35.000000000 +0200
@@ -151,16 +151,24 @@
     while ($subdir = readdir DIR) {
        my $subpath = $path . "/" . $subdir;
 
+       next if ( $subdir =~ /^[0-9]+\.$/ || 
+                 $subdir =~ /^\.\.$/ || 
+                 $subdir =~ /^\.$/ );
+       next if ( $subpath =~ /^\/socket$/ ||
+                 $subpath =~ /^\/stage\.$/ ||
+                 $subpath =~ /^\/sync\.$/ );
+
        if ($subdir =~ /^cyrus\.(.+)/s) {
            # cyrus.* file, see if we should migrate it
            if (defined($mfiles{$1})) {
+               # print "copy " . $part . $subpath . " to " . $mpart . $subpath 
."\n";
                copy($part . $subpath, $mpart . $subpath) ||
                    ouch "couldn't copy $part$subpath to $mpart$subpath";
                unlink($part . $subpath) ||
                    ouch "couldn't delete $part$subpath";
            }
        }
-       elsif ($subdir =~ /^[^\.]+$/s) {
+       else{
            # no dot in name, so this is a subdir, process it
            mkdir($mpart . $subpath, 0700) ||
                ouch "couldn't create $mpart$subpath";
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

Reply via email to