Re: [COMMITTERS] pgsql: Refactor Perl test code

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [COMMITTERS] pgsql: Refactor Perl test code
Дата
Msg-id 936.1449179853@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Refactor Perl test code  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Tom Lane wrote:
>> Michael Paquier <michael.paquier@gmail.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 fileopen(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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Raiskup
Дата:
Сообщение: Re: broken tests
Следующее
От: Kevin Grittner
Дата:
Сообщение: atomic reads & writes (with no barriers)