Bug 970288 - luci initscript does not check return values correctly
Summary: luci initscript does not check return values correctly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: conga
Version: 5.9
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Pokorný [poki]
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks:
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.
Clone Of:
Environment:
Last Closed: 2014-09-16 05:31:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 877999 0 high CLOSED luci not running after /etc/init.d/luci reports that it has started 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHSA-2014:1194 0 normal SHIPPED_LIVE Moderate: conga security and bug fix update 2014-09-16 09:28:53 UTC

Internal Links: 877999

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>&

Observed:

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

Expected:

# service luci stop && pgrep -f luci
Shutting down luci:                                        [ FAIL ]
31800
# 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
initscript:

> 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.

http://rhn.redhat.com/errata/RHSA-2014-1194.html


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