Bug 804290 - [PATCH] postgresql-setup fails to follow .include directives in postgresql.service
Summary: [PATCH] postgresql-setup fails to follow .include directives in postgresql.se...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: postgresql
Version: 16
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Tom Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-17 11:32 UTC by Marek Kielar
Modified: 2012-04-12 01:53 UTC (History)
3 users (show)

Fixed In Version: postgresql-9.1.3-3.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-31 02:59:47 UTC
Type: ---
Embargoed:


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

Description Marek Kielar 2012-03-17 11:32:50 UTC
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
[Service]
Environment=PGPORT=<CUSTOM_PORT>

, 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:
100%

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 11:33:53 UTC
This is somewhat similar to #802835 point 2).

Comment 2 Tom Lane 2012-03-17 14:15:09 UTC
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 16:09:21 UTC
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 17:17:28 UTC
postgresql-9.1.3-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/postgresql-9.1.3-3.fc17

Comment 5 Fedora Update System 2012-03-17 17:18:06 UTC
postgresql-9.1.3-3.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/postgresql-9.1.3-3.fc16

Comment 6 Fedora Update System 2012-03-18 19:33:35 UTC
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:
https://admin.fedoraproject.org/updates/FEDORA-2012-4130/postgresql-9.1.3-3.fc17
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2012-03-31 02:59:47 UTC
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-12 01:53:25 UTC
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.