Bug 970288 - luci initscript does not check return values correctly
Summary: luci initscript does not check return values correctly
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: conga (Show other bugs)
(Show other bugs)
Version: 5.9
Hardware: Unspecified Unspecified
Target Milestone: rc
: ---
Assignee: Jan Pokorný [poki]
QA Contact: Cluster QE
Keywords: EasyFix
Depends On:
TreeView+ depends on / blocked
Reported: 2013-06-03 21:46 UTC by Jan Pokorný [poki]
Modified: 2014-09-16 05:31 UTC (History)
4 users (show)

Fixed In Version: conga-0.12.2-70.el5
Doc Type: Bug Fix
Doc Text:
Cause: Improper return value check when stopping the luci service. Consequence: Luci reported as stopped even if, for some reason, it was not. Fix: Return value checked correctly when stopping the luci service. Result: Accurate diagnostics reported when stopping the luci service failed.
Story Points: ---
Clone Of:
Last Closed: 2014-09-16 05:31:00 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2014:1194 normal SHIPPED_LIVE Moderate: conga security and bug fix update 2014-09-16 09:28:53 UTC
Red Hat Bugzilla 877999 None None None Never

Description Jan Pokorný [poki] 2013-06-03 21:46:18 UTC
Reproducer could be something like this (untested)

# service luci start
# vim /etc/init.d/luci  # set LUCI_ZOPE_TIMEOUT=1
# <command to utilize the machine on 100% so luci stop is slow>&


# service luci stop && pgrep -f luci
Shutting down luci:                                        [  OK  ]


# service luci stop && pgrep -f luci
Shutting down luci:                                        [ FAIL ]
# grep '[lL]uci' /var/log/messages | tail -n1
[...] Luci did not stop after 1 seconds.


The issue is in bad handling of $? special variable in (1) the "if" inner
context and (2) the "while" outer context.  Bash man page says...

re (1):
> The exit status is the exit status of the last command executed, or zero if
> no condition tested true.

re (2):
> The exit status of the while and until commands is the exit status of the
> last do list command executed, or zero if none was executed.

Under this conditions, following snippet from stop function in luci

> while [ $cur_wait -lt $max_wait ]; do
>         sleep 1
>         cur_wait=`expr $cur_wait + 1`
>         luci_running
>         if [ $? -eq 0 ]; then
>                 break
>         fi
> done

will always have, immediately after being executed, exit code of zero
and it makes no sense to use it in subsequent conditionals.

Action items:
a. fix stop function so that it works as per "Expected"
b. check the correctness of exit code handling in other parts of initscript

Comment 6 errata-xmlrpc 2014-09-16 05:31:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.