Bug 197686

Summary: postgresql init script report incorrect return value
Product: Red Hat Enterprise Linux 4 Reporter: Marco Ceci <mceci>
Component: postgresqlAssignee: Tom Lane <tgl>
Status: CLOSED WONTFIX QA Contact: Kevin Baker <kbaker>
Severity: high Docs Contact:
Priority: high    
Version: 4.0CC: hhorak, iannis, ineilsen, psplicha
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:30:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 243288    
Attachments:
Description Flags
patch for the postgresql init script
none
another version of patch for postgresql-server's init script
none
another patch for postgresql init script (2) none

Description Marco Ceci 2006-07-05 15:04:33 UTC
Description of problem:

The postgresql script does not return a failure value under some conditions. I
have currently tested two conditions:
   1) stop of postgresql service when the process is not active
   2) start of postgresql with a broken configuration
in both cases the init script report correctly a failure but return a value of 0
(which means success) instead of 1 (which means failure) 

Version-Release number of selected component (if applicable):

postgresql-7.4.13-2.RHEL4.1

How reproducible:

always

Steps to Reproduce:
1. 
# /etc/init.d/postgresql start
Starting postgresql service:                               [  OK  ]

2.
# killall -9 postmaster
#

3.
# /etc/init.d/postgresql stop
Stopping postgresql service:                               [FAILED]
# echo $?
0

Actual results:

return a value of 0 for a failure.

Expected results:

return a value 1 for a failure. This error makes unrealiable and possibly
dangerous the use of this script with programs that make decision based on this
return value, such as cluster suite.


Additional info:

I am attaching a simple patch that fix the problem.

Comment 1 Marco Ceci 2006-07-05 15:04:33 UTC
Created attachment 131935 [details]
patch for the postgresql init script

Comment 2 Satoru SATOH 2006-12-06 07:55:07 UTC
Created attachment 142927 [details]
another version of patch for postgresql-server's init script

Hi,

I have exactly the same problem and created a similar patch before checking
this BZ, while testing postgresql with cluster suite.

I attached my version of patch, just for the record. 
Perhaps, it might be helpful.

(Reference: LSB 3.1.0 core 
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html)

Comment 3 Satoru SATOH 2006-12-06 10:53:40 UTC
Created attachment 142941 [details]
another patch for postgresql init script (2)

This patch contains some minor fixes and updates to treat the situation
mentioned in the LSB web page I referred in previous comment:

"""In addition to straightforward success, the following situations are also to
be considered successful:
    ...
    * running start on a service already running
    * running stop on a service already stopped or not running
    ...
"""

Comment 5 RHEL Program Management 2008-02-01 19:13:08 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 6 Tony Fu 2008-09-10 00:52:55 UTC
User mceci's account has been closed

Comment 7 RHEL Program Management 2010-10-22 18:57:36 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 9 Jiri Pallich 2012-06-20 13:30:06 UTC
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.