From: Greg Sabino Mullane Date: Fri, 10 Apr 2009 16:30:48 +0000 (-0400) Subject: Finally fix the space-in-directory issues - Jeff Boes. X-Git-Tag: 2.9.0~117 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=524db099f2f7eab3fa248fffc4e516194fabb517;p=check_postgres.git Finally fix the space-in-directory issues - Jeff Boes. --- diff --git a/check_postgres.pl b/check_postgres.pl index b09d324af..c46f2d3fa 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -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; diff --git a/t/CP_Testing.pm b/t/CP_Testing.pm index 66004378b..67ea10e58 100644 --- a/t/CP_Testing.pm +++ b/t/CP_Testing.pm @@ -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;