pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14014: postgresql95-setup script determines PGDATA wrongly
3+ messages / 3 participants
[nested] [flat]

* BUG #14014: postgresql95-setup script determines PGDATA wrongly
@ 2016-03-10 12:22  tigreavecdesailes@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: tigreavecdesailes@gmail.com @ 2016-03-10 12:22 UTC (permalink / raw)
  To: pgsql-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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14014: postgresql95-setup script determines PGDATA wrongly
@ 2016-04-26 16:23  Bruce Momjian <bruce@momjian.us>
  parent: tigreavecdesailes@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2016-04-26 16:23 UTC (permalink / raw)
  To: tigreavecdesailes@gmail.com; +Cc: pgsql-bugs


Uh, we don't have a postgresql95-setup file.  I think you need to file
this bug report with Red Hat or the author of this file.

---------------------------------------------------------------------------

On Thu, Mar 10, 2016 at 12:22:49PM +0000, tigreavecdesailes@gmail.com wrote:
> 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

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+                     Ancient Roman grave inscription +


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14014: postgresql95-setup script determines PGDATA wrongly
@ 2016-04-26 17:19  Devrim Gündüz <devrim@gunduz.org>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Devrim Gündüz @ 2016-04-26 17:19 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; tigreavecdesailes@gmail.com; +Cc: pgsql-bugs


Hi Bruce,

On Tue, 2016-04-26 at 12:23 -0400, Bruce Momjian wrote:
> 
> Uh, we don't have a postgresql95-setup file.  I think you need to file
> this bug report with Red Hat or the author of this file.

It is a shame that I missed the original post. We ship this file with the RPMs.
I'll reply the email soon.

Regards,
-- 
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2016-04-26 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 12:22 BUG #14014: postgresql95-setup script determines PGDATA wrongly tigreavecdesailes@gmail.com
2016-04-26 16:23 ` Bruce Momjian <bruce@momjian.us>
2016-04-26 17:19   ` Devrim Gündüz <devrim@gunduz.org>

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