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.
This is somewhat similar to #802835 point 2).
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.
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.
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
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
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).
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.
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.