Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 310619

Summary: Enhanced error handling in postgresql runscript
Product: Gentoo Linux Reporter: kfm
Component: [OLD] ServerAssignee: PgSQL Bugs <pgsql-bugs>
Status: RESOLVED FIXED    
Severity: enhancement CC: patrick, titanofold
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Implement meaningful start() error handling
Implement meaningful start() error handling (errata)

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.