Bug 804290 - [PATCH] postgresql-setup fails to follow .include directives in postgresql.service
[PATCH] postgresql-setup fails to follow .include directives in postgresql.se...
Product: Fedora
Classification: Fedora
Component: postgresql (Show other bugs)
Unspecified Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Tom Lane
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-03-17 07:32 EDT by Marek Kielar
Modified: 2012-04-11 21:53 EDT (History)
3 users (show)

See Also:
Fixed In Version: postgresql-9.1.3-3.fc17
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-03-30 22:59:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Proposed patch with partial fix (1.55 KB, patch)
2012-03-17 07:32 EDT, Marek Kielar
no flags Details | Diff

  None (edit)
Description Marek Kielar 2012-03-17 07:32:50 EDT
Created attachment 570789 [details]
Proposed patch with partial fix

Description of problem:
Following notes from default /lib/systemd/system/postgresql.service for customizing the PGPORT, ie. creating /etc/systemd/system/postgresql.service with:

.include /lib/systemd/system/postgresql.service

, effects in postgresql-setup ending up evaluating PGDATA="". Patch is attached that corrects specifically this behavior, extending support to both setting and not setting both variables.

However an actually proper way would be to get appropriate (in terms of systemd lookup priority) postgresql.service parsed, as to allow and follow other .include-s. Maybe systemd's .service parser itself can be made output the parsed file or otherwise leak this information?

Version-Release number of selected component (if applicable):
9.1 but it's systemd-related, so a version of FC, namely FC16, might be more appropriate

How reproducible:

Steps to Reproduce:
1. Get a clean install of postgresql package.
2. Follow /lib/systemd/system/postgresql.service instructions for customizing PGPORT.
3. Run "postgresql-setup initdb".
Actual results:
Evaluating PGDATA as equal "", as in:

$ postgresql-setup initdb
Initializing database ... mkdir: cannot create directory `': No such file or directory
failed, see /var/lib/pgsql/initdb.log

Expected results:
Evaluating PGDATA to an appropriate value from .service files.

Additional info:
Attached patch's fix is partial - see bug description.
Comment 1 Marek Kielar 2012-03-17 07:33:53 EDT
This is somewhat similar to #802835 point 2).
Comment 2 Tom Lane 2012-03-17 10:15:09 EDT
Oops ... yeah, that script is totally incapable of following include directives.  I agree that it would be best if we could have systemd do the gruntwork --- will ask around about that.
Comment 3 Tom Lane 2012-03-17 12:09:21 EDT
Per a suggestion from Tomasz Torcz, the right way to do this seems to be to use "systemctl show".  It's not 100% ideal --- AFAICT, there is no way to cope with PGDATA pathnames containing spaces, because the output format lists environment settings separated by spaces.  But that's a pretty minor and easily documented limitation.
Comment 4 Fedora Update System 2012-03-17 13:17:28 EDT
postgresql-9.1.3-3.fc17 has been submitted as an update for Fedora 17.
Comment 5 Fedora Update System 2012-03-17 13:18:06 EDT
postgresql-9.1.3-3.fc16 has been submitted as an update for Fedora 16.
Comment 6 Fedora Update System 2012-03-18 15:33:35 EDT
Package postgresql-9.1.3-3.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing postgresql-9.1.3-3.fc17'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 7 Fedora Update System 2012-03-30 22:59:47 EDT
postgresql-9.1.3-3.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2012-04-11 21:53:25 EDT
postgresql-9.1.3-3.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.