Re: [PATCH] pgbench tap tests fail if the path contains a perl special character

From: Raúl Marín Rodríguez <rmrodriguez(at)carto(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pgbench tap tests fail if the path contains a perl special character
Date: 2019-01-18 17:54:07
Message-ID: CAM6_UM7dm3LyExoVF2me2dCijd-e3o0oWEg3jKDrmg-b5x3Z4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> Fun. But is that really the only place that fails?

Yes, other than this it builds flawlessly.

> This does not look right to me: glob has a different set of special
> characters than regexes, no?

The issue itself manifests in the grep call, not in glob, but I tried
using `quotemeta` only for grep without success (probably because I didn't
know how to properly call `quotemeta` over @logs.

This is the first time I do anything in perl beyond adding some simple tap
tests, so this could be me not knowing how to deal with it properly. I used
this small script to understand perl's behaviour:

```
$ cat a.pl
#!/usr/bin/perl
use strict;
use warnings;

my @prefix = '~/postgres+XXXX/001_pgbench_log_2.20745';
my @quoted_prefix = quotemeta(@prefix);

my @found1 = grep(/^(at)prefix\(dot)\d+(\.\d+)?$/, "@prefix.20745");
my @found2 = grep(/^(at)prefix\(dot)\d+(\.\d+)?$/, "@quoted_prefix.20745");
my @found3 = grep(/^(at)quoted_prefix\(dot)\d+(\.\d+)?$/, "@prefix.20745");
my @found4 = grep(/^(at)quoted_prefix\(dot)\d+(\.\d+)?$/, "@quoted_prefix.20745");
print "1: @found1\n";
print "2: @found2\n";
print "3: @found3\n";
print "4: @found4\n";

$ perl a.pl
1:
2:
3:
4: 1.20745
```

Regards,
--
Raúl Marín Rodríguez
carto.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-01-18 17:56:22 Re: PSA: we lack TAP test coverage on NetBSD and OpenBSD
Previous Message Tom Lane 2019-01-18 17:35:49 Re: [PATCH] pgbench tap tests fail if the path contains a perl special character