mirror of
https://github.com/postgres/postgres.git
synced 2025-06-10 09:21:54 +03:00
Fix old TAP tests' method for selecting a valid PGPORT value.
This code was trying to be paranoid, but it wasn't paranoid enough. It only ensured that the selected port is in 0..65535, while most Unix systems will refuse unprivileged attempts to use TCP port numbers below 1024. Change it to allow specification of ports 1024..65535, while if the port is outside that range, map it into 49152..65535 which is the port range used by our later branches. The main reason we've not noticed this up to now is that it's not important when testing over Unix-socket connections, only TCP, and most of our test code deliberately prevents the postmaster from opening any TCP ports. However, the SSL tests do open up a TCP port, and I believe this explains why buildfarm member chipmunk has been failing the SSL tests in 9.5: it's picking a reserved port number. Patch in 9.5 and 9.4. Later branches do not use this code.
This commit is contained in:
parent
7c86b94311
commit
e1d8f18b87
@ -100,7 +100,12 @@ if (!$ENV{PGPORT})
|
||||
$ENV{PGPORT} = 65432;
|
||||
}
|
||||
|
||||
$ENV{PGPORT} = int($ENV{PGPORT}) % 65536;
|
||||
# Force a sane value of PGPORT
|
||||
$ENV{PGPORT} = int($ENV{PGPORT});
|
||||
if ($ENV{PGPORT} < 1024 || $ENV{PGPORT} > 65535)
|
||||
{
|
||||
$ENV{PGPORT} = ($ENV{PGPORT} % 16384) + 49152;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user