From 524db099f2f7eab3fa248fffc4e516194fabb517 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 10 Apr 2009 12:30:48 -0400 Subject: [PATCH] Finally fix the space-in-directory issues - Jeff Boes. --- check_postgres.pl | 2 +- t/CP_Testing.pm | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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; -- 2.39.5