Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 310045 - postgresql.init doesn't return immediately if failed to start
Summary: postgresql.init doesn't return immediately if failed to start
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-18 11:23 UTC by Sok Ann Yap
Modified: 2010-06-04 14:19 UTC (History)
2 users (show)

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 Sok Ann Yap 2010-03-18 11:23:32 UTC
In postgresql.init, there is this line in start():

[ $retval -ne 0 ] && eend $retval && return $retval

If I am not mistaken, the "return $retval" part will never be executed. This then causes the eerror further down to be printed, when it shouldn't be.

Reproducible: Always
Comment 1 Aaron W. Swenson gentoo-dev 2010-03-21 02:08:04 UTC
Provided that the test returns true, and the eend $retval command is executed successfully, then return $retval will be executed.

Think of it more as how you string commands together on the command line:

    user $ run_this && then_run_this && finally_run_this

If 'run_this' finishes successfully, then 'then_run_this' will be executed. If that finishes successfully, then 'finally_run_this' will be executed.

But, if any of those commands fail, then the successive command(s) will not be executed.
Comment 2 Sok Ann Yap 2010-03-21 03:03:25 UTC
What you (and the maintainer) didn't realize is that "eend $retval" will return whatever value $retval is. Thus,

eend 2 && echo "this will never be executed"
Comment 3 (RETIRED) gentoo-dev 2010-03-21 04:42:28 UTC
Marking INVALID, per comment #1.
Comment 4 (RETIRED) gentoo-dev 2010-03-21 04:46:13 UTC
Reopening, as the reporter was right after all. Moral being let things play out more before acting based on irc.
Comment 5 Aaron W. Swenson gentoo-dev 2010-03-21 05:11:49 UTC
(In reply to comment #2)
> What you (and the maintainer) didn't realize is that "eend $retval" will return
> whatever value $retval is. Thus,
> 
> eend 2 && echo "this will never be executed"
> 

Okay, so I was a bit hasty. (And the lack of easy to find documentation on eend didn't help either.)

Edit that line so it looks like so instead:
    if [ $retval -ne 0 ] ; then
        eend $retval
        return $retval
    fi

See if that fixes the issue.
Comment 6 Aaron W. Swenson gentoo-dev 2010-03-24 00:05:23 UTC
Addressed in bug #311047
Comment 7 Patrick Lauer gentoo-dev 2010-06-04 14:19:32 UTC
Committed.