Commit 344567ea authored by Christoph Berg's avatar Christoph Berg

RPM: Set the default unix socket directory to /tmp.

parent 90836dcf
......@@ -398,7 +398,9 @@ $orig_egid = $);
$) = $ownergid;
$> = $owneruid;
unless ($socketdir) {
if (-w '/var/run/postgresql') {
if ($PgCommon::rpm) {
$socketdir = '/tmp'; # RedHat defaults to /tmp in libpq et al.
} elsif (-w '/var/run/postgresql') {
$socketdir = '/var/run/postgresql';
} else {
......@@ -10,10 +10,13 @@ No separate PostgreSQL client/server packages are provided; the port is backed
by the PGDG RPM packages from
The filesystem layout is unchanged, /etc/postgresql, /etc/postgresql-common,
/var/lib/postgresql, and /var/run/postgresql are used as before.
and /var/lib/postgresql are used as before.
Differences between the Debian and RedHat operating modes are:
* /var/run/postgresql/ is still used for external pid files, but the default
unix socket directory is /tmp, to match the RPM packages' default.
* The postgres system user home is /var/lib/pgsql.
* The binroot is changed from /usr/lib/postgresql/ to /usr/pgsql-. (Note the
......@@ -22,8 +22,12 @@ sub check_major {
"pg_createcluster $v main");
# check that a /var/run/postgresql/ pid file is created
ok_dir '/var/run/postgresql/', ['.s.PGSQL.5432', '.s.PGSQL.5432.lock', "$"],
'Socket and pid file are in /var/run/postgresql/';
unless ($PgCommon::rpm) {
ok_dir '/var/run/postgresql/', ['.s.PGSQL.5432', '.s.PGSQL.5432.lock', "$"],
'Socket and pid file are in /var/run/postgresql/';
} else {
ok_dir '/var/run/postgresql/', ["$"], 'Pid File is in /tmp';
# verify that exactly one postmaster is running
my @pm_pids = pidof (($v >= '8.2') ? 'postgres' : 'postmaster');
......@@ -55,8 +59,12 @@ sub check_major {
# Now there should not be an external PID file any more, since we set it
# explicitly
ok_dir '/var/run/postgresql', ['.s.PGSQL.5432', '.s.PGSQL.5432.lock'],
'Socket, but not PID file in /var/run/postgresql/';
unless ($PgCommon::rpm) {
ok_dir '/var/run/postgresql', ['.s.PGSQL.5432', '.s.PGSQL.5432.lock'],
'Socket, but not PID file in /var/run/postgresql/';
} else {
ok_dir '/var/run/postgresql', [], '/var/run/postgresql/ is empty';
# verify that the correct client version is selected
like_program_out 'postgres', 'createdb --version', 0, qr/^createdb \(PostgreSQL\) $v/,
......@@ -262,7 +262,7 @@ is ((exec_as 'postgres', "pg_ctlcluster $version main start"), 0,
'pg_ctlcluster: main cluster on conflicting port starts');
# clusters can run side by side on different socket directories
set_cluster_socketdir $version, 'other', '/tmp';
set_cluster_socketdir $version, 'other', $socketdir;
PgCommon::set_conf_value $version, 'other', 'postgresql.conf',
'listen_addresses', ''; # otherwise they will conflict on TCP socket
is ((exec_as 'postgres', "pg_ctlcluster $version other start"), 0,
......@@ -270,7 +270,7 @@ is ((exec_as 'postgres', "pg_ctlcluster $version other start"), 0,
is ((exec_as 'postgres', "pg_ctlcluster $version other stop"), 0);
# ... but will give an error when running on the same port
set_cluster_socketdir $version, 'other', '/var/run/postgresql';
set_cluster_socketdir $version, 'other', $PgCommon::rpm ? '/tmp' : '/var/run/postgresql';
like_program_out 'postgres', "pg_ctlcluster $version other start", 1,
qr/Port conflict:.*port 5432/,
'pg_ctlcluster other cluster fails on conflicting port and same socket dir';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment