Hi,

As mentioned in the subject, if the $PATH where you are building postgres
contains a perl's special character [1], for example a `+`, pgbench's tap
tests will fail.

The outputs looks something like this (full at [2]):
```
#   Failed test 'file name format'
#   at t/001_pgbench_with_server.pl line 805.

#   Failed test 'file name format'
#   at t/001_pgbench_with_server.pl line 805.
# Looks like you failed 2 tests of 312.
t/001_pgbench_with_server.pl ..
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/312 subtests
t/002_pgbench_no_server.pl .... ok
```

This error affects both PG11 and master, and a way to reproduce it is by
renaming the source folder from `postgresql` to `postgresql+XXX`.

I'm attaching a patch to fix this by using quotemeta [3]. It's generated
from master and also applies to REL_11_STABLE.

1 - http://jkorpela.fi/perl/regexp.html
2 - 
https://launchpadlibrarian.net/406634533/buildlog_ubuntu-xenial-amd64.postgresql-11_11.1.1+carto-2_BUILDING.txt.gz
3 - https://perldoc.perl.org/functions/quotemeta.html


Regards,
--
Raúl Marín Rodríguez
carto.com
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index c87748086a..eb126d2525 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -879,9 +879,10 @@ sub check_pgbench_logs

 	my ($prefix, $nb, $min, $max, $re) = @_;

-	my @logs = glob "$prefix.*";
+    my @quoted_prefix = quotemeta($prefix);
+	my @logs = glob "@quoted_prefix.*";
 	ok(@logs == $nb, "number of log files");
-	ok(grep(/^$prefix\.\d+(\.\d+)?$/, @logs) == $nb, "file name format");
+	ok(grep(/^@quoted_prefix\.\d+(\.\d+)?$/, @logs) == $nb, "Failed to match file format. Looked for (@quoted_prefix) in (@logs)");

 	my $log_number = 0;
 	for my $log (sort @logs)

Reply via email to