Finally fix the space-in-directory issues - Jeff Boes.
authorGreg Sabino Mullane <[email protected]>
Fri, 10 Apr 2009 16:30:48 +0000 (12:30 -0400)
committerGreg Sabino Mullane <[email protected]>
Fri, 10 Apr 2009 16:30:48 +0000 (12:30 -0400)
check_postgres.pl
t/CP_Testing.pm

index b09d324af67b4d8d4032332e4de40c2d43a05032..c46f2d3faa781634844e0fa58f2dc2c00de83336 100755 (executable)
@@ -1409,7 +1409,7 @@ sub run_command {
                        }
                        if (defined $opt{$v}->[$gbin]) {
                                my $new = $opt{$v}->[$gbin];
-                               $new =~ s/\s+//g unless $vname eq 'dbservice';
+                               $new =~ s/\s+//g unless $vname eq 'dbservice' or $vname eq 'host';
                                ## Set this as the new default
                                $conn->{$vname} = [split /,/ => $new];
                                $foundgroup = 1;
index 66004378b87d5277aa641e85f7880c8a8be3e115..67ea10e58d90b604d7aa63cb07856dbf9b07f495 100644 (file)
@@ -126,7 +126,11 @@ sub test_database_handle {
        } ## end of needs startup
 
        my $here = cwd();
-       my $dsn = qq{dbi:Pg:host=$here/$dbdir/data/socket;dbname=postgres};
+       my $dbhost = $self->{dbhost} = "$here/$dbdir/data/socket";
+       $dbhost =~ s/^ /\\ /;
+       $dbhost =~ s/([^\\]) /$1\\ /g;
+       $self->{dbname} = 'postgres';
+       my $dsn = qq{dbi:Pg:host=$dbhost;dbname=$self->{dbname}};
        my @superdsn = ($dsn, '', '', {AutoCommit=>0,RaiseError=>1,PrintError=>0});
        my $dbh = DBI->connect(@superdsn);
        $dbh->ping() or die qq{Failed to ping!\n};
@@ -143,8 +147,6 @@ sub test_database_handle {
        $dbh->{AutoCommit} = 0;
        $dbh->{RaiseError} = 1;
 
-       $self->{dbhost} = "$here/$dbdir/data/socket";
-       $self->{dbname} = 'postgres';
        $self->{dbh} = $dbh;
        $self->{dsn} = $dsn;
        $self->{superdsn} = \@superdsn;