Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 391851 - dev-db/postgresql-server-9.1 : init script does not honour postgresql.conf settings
Summary: dev-db/postgresql-server-9.1 : init script does not honour postgresql.conf se...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-25 10:56 UTC by Bèrto 'd Sèra
Modified: 2011-12-08 03:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
reads postgresql.conf value for port and uses it (portconfig.patch,1.37 KB, text/plain)
2011-11-25 10:57 UTC, Bèrto 'd Sèra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bèrto 'd Sèra 2011-11-25 10:56:12 UTC
The current postgresql-9.1 init script does not read port configuration from the postgresql.conf file, resulting in a wrong error message about port conflict, when there is no such conflict. This is a minor blocker when running slotted versions (you get suggested to alter PGPORT, which would work).

The suggested solution is, however, a bit weird, since after a correct configuration one should not need to fiddle with variables (and postgresql docs are clearly pointing anyone to use postgresql.conf for this issue). 

I attach a patch I made for my system. I'm positive there are much more elegant ways to make it, but it works for my box.
Comment 1 Bèrto 'd Sèra 2011-11-25 10:57:00 UTC
Created attachment 293701 [details]
reads postgresql.conf value for port and uses it
Comment 2 Bèrto 'd Sèra 2011-11-25 11:31:34 UTC
On a second thought, the script in the ebuild would fail to detect a real port conflict, just as well. All it takes is to have one admin modifying PGPORT to bypass the script blocker, then a second edit to the postgresql.conf file, that would state an explicit 5332 value for the port. I haven't checked it personally, but I cannot really see how this could be avoided.
Comment 3 Aaron W. Swenson gentoo-dev 2011-11-25 14:52:12 UTC
(In reply to comment #2)
> On a second thought, the script in the ebuild would fail to detect a real port
> conflict, just as well. All it takes is to have one admin modifying PGPORT to
> bypass the script blocker, then a second edit to the postgresql.conf file, that
> would state an explicit 5332 value for the port. I haven't checked it
> personally, but I cannot really see how this could be avoided.

Postgres would determine the conflict. The initscript does pass back the error. (At least, it should. It's been a while since I've tested the error handling of the initscript.

I like this patch, though, and I'll commit the changes.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-11-29 16:14:58 UTC
I would suggest using awk rather than the readconf function tbh, for the sake of maintainability, but I hit this as well so I wouldn't mind getting it fixed myself if it needs to...
Comment 5 Aaron W. Swenson gentoo-dev 2011-11-30 00:01:09 UTC
(In reply to comment #4)
> I would suggest using awk rather than the readconf function tbh, for the sake
> of maintainability, but I hit this as well so I wouldn't mind getting it fixed
> myself if it needs to...

Right, I actually came up with something using grep and sed. awk and I are not friends.
Comment 6 Aaron W. Swenson gentoo-dev 2011-12-08 03:16:57 UTC
  08 Dec 2011; Aaron W. Swenson <titanofold@gentoo.org>
  +postgresql-server-8.2.23.ebuild, +postgresql-server-8.3.17.ebuild,
  +postgresql-server-8.4.10.ebuild, +postgresql-server-9.0.6.ebuild,
  +postgresql-server-9.1.2.ebuild:
  Version bump. Fixes bugs 391851, 383471, and 378865.