Re: [PATCH] pgbench tap tests fail if the path contains a perlspecial character - Mailing list pgsql-hackers

From Raúl Marín Rodríguez
Subject Re: [PATCH] pgbench tap tests fail if the path contains a perlspecial character
Date
Msg-id CAM6_UM7dm3LyExoVF2me2dCijd-e3o0oWEg3jKDrmg-b5x3Z4A@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] pgbench tap tests fail if the path contains a perl special character  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] pgbench tap tests fail if the path contains a perlspecial character  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List 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(/^@prefix\.\d+(\.\d+)?$/, "@prefix.20745");
my @found2 = grep(/^@prefix\.\d+(\.\d+)?$/, "@quoted_prefix.20745");
my @found3 = grep(/^@quoted_prefix\.\d+(\.\d+)?$/, "@prefix.20745");
my @found4 = grep(/^@quoted_prefix\.\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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] pgbench tap tests fail if the path contains a perl special character
Next
From: Tom Lane
Date:
Subject: Re: PSA: we lack TAP test coverage on NetBSD and OpenBSD