From: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [COMMITTERS] pgsql: Clean up Perl code according to perlcritic |
Date: | 2017-03-28 11:18:27 |
Message-ID: | 88bc7984-f630-0629-e8f5-36211a31601c@2ndQuadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
On 03/27/2017 08:58 PM, Tom Lane wrote:
> I wrote:
>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>>> Clean up Perl code according to perlcritic
>> This seems to have broken the regression tests (specifically, dblink)
>> on at least some of the Windows buildfarm critters.
> I'm hardly a Perl expert, but it looks to me like the culprit is this
> hunk in vcregress.pl:
>
> @@ -521,8 +521,9 @@ sub fetchRegressOpts
> # an unhandled variable reference. Ignore anything that isn't an
> # option starting with "--".
> @opts = grep {
> - s/\Q$(top_builddir)\E/\"$topdir\"/;
> - $_ !~ /\$\(/ && $_ =~ /^--/
> + my $x = $_;
> + $x =~ s/\Q$(top_builddir)\E/\"$topdir\"/;
> + $x !~ /\$\(/ && $x =~ /^--/
> } split(/\s+/, $1);
> }
> if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
>
> The first line in that block is actually intending to modify the value
> it's inspecting, and perlcritic's "improved" version carefully removes
> the side-effect.
>
> No doubt there are cleaner ways to do that (the comments in "man perlfunc"
> about this coding technique are not positive), but this way is not
> cleaner, it is broken.
>
>
I would try something like this:
@opts = grep { $_ !~ /\$\(/ && $_ =~ /^--/ }
map { s/\Q$(top_builddir)\E/\"$topdir\"/; }
split(/\s+/, $1);
but I don't have time to test it before I leave for pgconfUS.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2017-03-28 11:30:22 | Re: [COMMITTERS] pgsql: Clean up Perl code according to perlcritic |
Previous Message | Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?= | 2017-03-28 09:23:57 | Re: [COMMITTERS] pgsql: Clean up Perl code according to perlcritic |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2017-03-28 11:30:22 | Re: [COMMITTERS] pgsql: Clean up Perl code according to perlcritic |
Previous Message | Amit Langote | 2017-03-28 10:50:45 | Re: pg_dump emits ALTER TABLE ONLY partitioned_table |