From: tigreavecdesailes@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14014: postgresql95-setup script determines PGDATA wrongly
Date: Thu, 10 Mar 2016 12:22:49 +0000
Message-ID: <20160310122249.8904.72105@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14014
Logged by: leonty
Email address: tigreavecdesailes@gmail.com
PostgreSQL version: 9.5.1
Operating system: RHEL 7.2
Description:
The script postgresql95-setup tries to determine the PGDATA directory two
times:
1. first time using a systemctl call. That's ok, systemctl knows all
possible unit file places and processes correctly the drop-ins (a directory
in /etc/systemd/system/ ending with '.d' where partial configurations are
stored).
2. second time (why at all??) in a few lines using sed utility to parse the
unit file. That's wrong because drop-in directories won't be considered and
overridden PGDATA environment is missed.
How to reproduce:
create /etc/systemd/system/postgresql-9.5.service.d/pgdata.conf with the
following content:
[Service]
Environment=PGDATA=/tmp/another_postgresql_location
run 'postgresql95-setup initdb', get a successful result message, then run
'systemctl start postgresql-9.5'. The database won't start, the log contains
a message that the database is not initialized.
How to fix:
Probably it's just enough to delete the second try of parsing the unit file
from postgresql95-setup script. Lines 103-104:
# Get data directory from the service file
PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tigreavecdesailes@gmail.com
Subject: Re: BUG #14014: postgresql95-setup script determines PGDATA wrongly
In-Reply-To: <20160310122249.8904.72105@wrigleys.postgresql.org>
References: <20160310122249.8904.72105@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox