PostgresNode::_update_pid using undefined variables in tap tests - Mailing list pgsql-hackers

From Michael Paquier
Subject PostgresNode::_update_pid using undefined variables in tap tests
Date
Msg-id CAB7nPqTOP28Zxv_SXFo2axGJoesfvLLMO6syddAfV0DUvsFMDw@mail.gmail.com
Whole thread Raw
Responses Re: PostgresNode::_update_pid using undefined variables in tap tests  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi all,

While running the test suite this morning I have noticed the following error:
server stopped
readline() on closed filehandle $pidfile at
/Users/ioltas/git/postgres/src/bin/pg_rewind/../../../src/test/perl/PostgresNode.pm
line 308.
Use of uninitialized value in concatenation (.) or string at
/Users/ioltas/git/postgres/src/bin/pg_rewind/../../../src/test/perl/PostgresNode.pm
line 309.
# Postmaster PID is

This does not impact the run, but it creates unwelcome warnings in the
logs. This is actually caused by the following code in PostgresNode
that uses an incorrect check to see if the file has been correctly
opened or not:
    open my $pidfile, $self->data_dir . "/postmaster.pid";
    if (not defined $pidfile)

One way to fix this is to use if(open(...)), a second way I know of is
to check if the opened file handle matches tell($pidfile) == -1. The
patch attached uses the first method to fix the issue.
Regards,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: psql --help=variables lists variables that can't be set
Next
From: Haribabu Kommi
Date:
Subject: Re: pg_hba_lookup function to get all matching pg_hba.conf entries