Re: [COMMITTERS] pgsql: Refactor Perl test code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Refactor Perl test code
Date: 2015-12-03 21:57:33
Message-ID: 936.1449179853@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> Tom Lane wrote:
>> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>>> Well, it showed up on my terminal...

>> Not on mine, as per the extract I showed. Probably a Perl version
>> difference, but I don't think we can exactly write off RHEL6 as an
>> uninteresting obsolete distribution. (The Perl here is 5.10.1.)

> Hmm, maybe a selinux policy or something like that is preventing some
> system call from working,

Good thought, but overcomplicated. After some quality time with strace,
I find that the
Undefined subroutine &TestLib::run called at /home/postgres/pgsql/src/bin/initdb
/../../../src/test/perl/TestLib.pm line 146.
error message does indeed appear, but it's printed only into
src/bin/initdb/tmp_check/log/regress_log_001_initdb

It appears that the reason this happens is that the child perl process
(of the two that are active in this area of the trace) decides at one
point along the line to redirect its own stdout and stderr into that
file, disconnecting them from the pipes leading to the parent process.
So when that process prints "Undefined subroutine" to its stderr, that
is where it goes.

I suppose that the redirection is a result of this bit in TestLib.pm:

# Hijack STDOUT and STDERR to the log file
open(ORIG_STDOUT, ">&STDOUT");
open(ORIG_STDERR, ">&STDERR");
open(STDOUT, ">&TESTLOG");
open(STDERR, ">&TESTLOG");

so the question from my end is not so much why it doesn't work for me
as how it could possibly work for you. Could the newer Perl version
be detecting the undefined-subroutine error before it executes the
file's INIT stanza, rather than after? Or maybe the "tie" stuff
happening just below this acts differently in more modern Perls?

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2015-12-03 22:23:02 pgsql: Further tweak commit_timestamp behavior
Previous Message Alvaro Herrera 2015-12-03 20:28:08 Re: [COMMITTERS] pgsql: Refactor Perl test code

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2015-12-03 22:10:51 atomic reads & writes (with no barriers)
Previous Message Pavel Raiskup 2015-12-03 21:50:38 Re: broken tests