Bug 1236559
| Summary: | tigervnc's lock file is not removed after stopping vncserver service | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Frantisek Sumsal <fsumsal> | ||||
| Component: | tigervnc | Assignee: | Jan Grulich <jgrulich> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Desktop QE <desktop-qa-list> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 6.8 | CC: | fsumsal, psklenar, tpelka | ||||
| Target Milestone: | rc | Keywords: | Patch | ||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2016-05-10 20:09:32 UTC | Type: | Bug | ||||
| 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: | 1271696 | ||||||
| Attachments: |
|
||||||
|
Description
Frantisek Sumsal
2015-06-29 12:39:24 UTC
(In reply to Frantisek Sumsal from comment #0) > This problem is caused by wrong values/conditions in stop() function of > /etc/init.d/vncserver file, which has been already fixed in the upstream > version of initscript file. Could you please clarify what you think the fix is? As you can see, the old stop() function [1] removes lock file only when value of STOPPED is 0. But when you try to stop vncserver service for the first time, for loop will increment value of STOPPED for each successfully stopped vnc server, thus the STOPPED value after for loop won't be 0 and the lock file won't get deleted [3].
Nevertheless, new stop() function [2] relies only on return value of 'status Xvnc', which works as it should [4].
-----
[1] stop() function present in current RHEL 6 TigerVNC build:
stop() {
[ "$EUID" != "0" ] && exit 4
echo -n $"Shutting down $prog: "
status Xvnc > /dev/null 2>&1
RETVAL=$?
STOPPED=0
# 3 means service is already stopped
if ! [ "$RETVAL" -eq 3 ]; then
for display in ${VNCSERVERS}; do
echo -n "${display} "
export USER="${display##*:}"
runuser ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
RETVAL=$?
[ "$RETVAL" -eq 0 ] && STOPPED=`expr $STOPPED + 1`
done
RETVAL=$?
else
let STOPPED=1
let RETVAL=0
fi
[ "$STOPPED" -gt 0 ] && success $"vncserver shutdown" || \
failure $"vncserver shutdown"
echo
[ "$STOPPED" -eq 0 ] && rm -f /var/lock/subsys/Xvnc
return "$RETVAL"
}
[2] stop() function present in upstream:
stop() {
[ "$EUID" != "0" ] && exit 4
echo -n $"Shutting down $prog: "
status Xvnc > /dev/null 2>&1
RETVAL=$?
# 3 means service is already stopped
if ! [ "$RETVAL" -eq 3 ]; then
for display in ${VNCSERVERS}; do
echo -n "${display} "
export USER="${display##*:}"
runuser ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
done
RETVAL=$?
else
let RETVAL=0
fi
[ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \
failure $"vncserver shutdown"
echo
[ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/Xvnc
return "$RETVAL"
}
[3] Stopping service with old stop() function (with some debug info):
# First call of 'service vncserver stop'
# service vncserver stop
Shutting down VNC server: Before loop: $RETVAL = 0
Stopping vncserver 7:bd87a3f0
7:bd87a3f0 7:bd87a3f0 stopped: $RETVAL = 0, $STOPPED = 1
After loop: $STOPPED = 1
# Second call
# service vncserver stop
Shutting down VNC server: Before loop: $RETVAL = 2
Stopping vncserver 7:bd87a3f0
7:bd87a3f0 7:bd87a3f0 stopped: $RETVAL = 2, $STOPPED = 0
After loop: $STOPPED = 0
[FAILED]
Removing lock file...
[4] Stopping service with new stop() function:
# service vncserver stop
Shutting down VNC server: 7:bd87a3f0 [ OK ]
Removing lock file...
Oh I see. That's the wrong way around: the STARTED stuff is newer than the upstream code, but a bug crept in at some point ('-eq' should be '-gt' in that test). See bug #768405.
Created attachment 1045404 [details]
fix for vncserver.init
This is the fix.
Fixed in tigervnc-1.1.0-17.el6. 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. https://rhn.redhat.com/errata/RHBA-2016-0775.html |