[Rt-commit] rt branch, 4.0/rt-setup-database-upgrade-bulletproofing, created. rt-4.0.13-85-gbf55b9e

Thomas Sibley trs at bestpractical.com
Tue Jun 18 19:50:00 EDT 2013


The branch, 4.0/rt-setup-database-upgrade-bulletproofing has been created
        at  bf55b9e044bc3ab8be73ac8641ee4a86bc212cf4 (commit)

- Log -----------------------------------------------------------------
commit feeccd1f506458ed2a8aca5612830848a27a0e44
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jun 18 16:41:50 2013 -0700

    Anchor the upgrade directory regex to avoid potential false positives
    
    This means we can't use upgrade directories named like
    rt-4.1.13-18-gf349104, but that's okay.

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index ddb286b..7cb8cec 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -409,7 +409,7 @@ sub get_versions_from_to {
     my ($base_dir, $from, $to) = @_;
 
     opendir( my $dh, $base_dir ) or die "couldn't open dir: $!";
-    my @versions = grep -d "$base_dir/$_" && /\d+\.\d+\.\d+/, readdir $dh;
+    my @versions = grep -d "$base_dir/$_" && /^\d+\.\d+\.\d+$/, readdir $dh;
     closedir $dh;
 
     return

commit bf55b9e044bc3ab8be73ac8641ee4a86bc212cf4
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jun 18 16:43:21 2013 -0700

    Bail if it looks like --datadir is wrong during upgrade

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 7cb8cec..952346e 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -412,6 +412,9 @@ sub get_versions_from_to {
     my @versions = grep -d "$base_dir/$_" && /^\d+\.\d+\.\d+$/, readdir $dh;
     closedir $dh;
 
+    die "\nERROR: No upgrade data found in '$base_dir'!  Perhaps you specified the wrong --datadir?\n"
+        unless @versions;
+
     return
         grep defined $to ? RT::Handle::cmp_version($_, $to) <= 0 : 1,
         grep RT::Handle::cmp_version($_, $from) > 0,

-----------------------------------------------------------------------


More information about the Rt-commit mailing list