Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 91929 - Postgres ebuild fails to setup log file if it's not in the default place
Summary: Postgres ebuild fails to setup log file if it's not in the default place
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-08 12:24 UTC by Luca Lesinigo
Modified: 2007-04-01 21:14 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Lesinigo 2005-05-08 12:24:33 UTC
running ebuild /var/db/postgres-<whatever/postgres-<whatever>.ebuild config sets up directories & co and then says you can run postgres via /etc/init.d/postgresql start.
But if you edit conf.d/postgresql to place the log file in another directory (/var/log, for example) it won't start.

That's because the ebuild does not touch & chmod it. The default path works ok because the dir is owned by postgres user.

Quick & easy solution: add to the config section of the ebuild something like
touch $POSTGRES_LOG_FILE
chown $POSTGRES_UID:$POSTGRES_GID $POSTGRES_LOG_FILE
chmod 600 $POSTGRES_LOG_FILE

Reproducible: Always
Steps to Reproduce:
1. emerge postgresql
2. edit /etc/conf.d/postgresql and move the log file somewhere else
3. ebuild config
4. try to start the db

Actual Results:  
 * Starting PostgreSQL...
sh: line 1: /var/log/postgresql.log: Permission denied

Expected Results:  
it should have worked ok :)

I'm using postgresql-8.0.1-r2, didn't check other versions.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-05-08 14:08:44 UTC
Why is this a bug? The ebuild works, if you want to move postgresql log to somewhere else, then set the location _after_ you have run ebuild config and set the permissions as needed... 
Comment 2 Luca Lesinigo 2005-05-08 15:46:37 UTC
Why shouldn't it be a bug, even if it's a small one?

I thought that if there is the ebuild config stuff, and if it in the end says "OK, you're setup, run init.d/postgresql start, be happy", it should give me a consistent setup.

If you want the user and not the ebuild to take care of a touch & chmod, then remove all the ebuild config stuff and tell him to RTFM and setup postgres himself. That will leave you in a consistent state, and not in an halfway one.

If that's not possible, the "Success. You can now start the database server using blahblah" message is actually a bug because it's wrong, and it should be changed in something like "Success. Maybe you can now start the database server, but look around if you eventually have to do something else before".

PS, the first thing you can setup in conf.d/postgresql is the database directory. And you need to do that *before* running the ebuild config. Same applies for $PGUSER.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-04-01 21:14:34 UTC
This works just fine by default; if you need another location, see comment #1