Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 310619 - Enhanced error handling in postgresql runscript
Summary: Enhanced error handling in postgresql runscript
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-21 22:15 UTC by kfm
Modified: 2010-06-04 14:18 UTC (History)
2 users (show)

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


Attachments
Implement meaningful start() error handling (postgresql.init-8.4-error-handling.patch,1.16 KB, patch)
2010-03-21 22:16 UTC, kfm
Details | Diff
Implement meaningful start() error handling (errata) (postgresql.init-8.4-error-handling.patch,1.06 KB, patch)
2010-03-21 22:21 UTC, kfm
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kfm 2010-03-21 22:15:05 UTC
The attached patch implements a formal method for conveying error messages to the user in the event that pg_ctl fails to start postgres. This is accomplished in the following manner:

1) Using -d to daemonize so that we are able to capture stderr
   (as opposed to silent mode)

2) Using command substition syntax to perform the capturing process

3) Conveying the message as a secondary parameter to eend, should an error occur

NOTE: this patch also contains the fix detailed in bug 310045.

One way to test this patch is to change the ownership of the $PGDATA directory to root. That will prevent postgres from starting and, rather than displaying no meaningful message to the user, it should terminate as thus:

* Starting PostgreSQL ...
pg_ctl: could not open PID file "/var/lib/postgresql/8.4/data/postmaster.pid": Permission denied  [ !! ]
 * ERROR: postgresql-8.4 failed to start
Comment 1 kfm 2010-03-21 22:16:46 UTC
Created attachment 224589 [details, diff]
Implement meaningful start() error handling
Comment 2 kfm 2010-03-21 22:21:09 UTC
Created attachment 224591 [details, diff]
Implement meaningful start() error handling (errata)

Oops, last patch introduced an unintended change relative to the existing script. This one is good.
Comment 3 Aaron W. Swenson gentoo-dev 2010-03-24 00:04:42 UTC
Addressed in bug #311047
Comment 4 Patrick Lauer gentoo-dev 2010-06-04 14:18:41 UTC
Committed.