Bug 470828 - function 'status' returns wrong result if the argument is not a single word
function 'status' returns wrong result if the argument is not a single word
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: initscripts (Show other bugs)
4.8
All Linux
medium Severity medium
: rc
: ---
Assigned To: initscripts Maintenance Team
BaseOS QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-10 09:53 EST by Michael Mráka
Modified: 2009-01-27 11:53 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-27 11:38:27 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Michael Mráka 2008-11-10 09:53:58 EST
+++ This bug was initially created as a clone of Bug #468060 +++

Escalated to Bugzilla from IssueTracker

--- Additional comment from tao@redhat.com on 2008-10-22 11:55:31 EDT ---

Description of problem:
"service rhn-satellite status" shows wrong status of osa-dispatcher daemon

Version-Release number of selected component:
osa-dispatcher-5.1.0-7.el4

How reproducible:
Always

Steps to Reproduce:
1. service rhn-satellite stop
2. python -c 'import time; import os; print "pid: %d" % os.getpid() ; time.sleep(1000)'
3. service rhn-satellite status or service osa-dispatcher status

Actual results:
# service rhn-satellite stop
# python -c 'import time; import os; print "pid: %d" % os.getpid() ; time.sleep(1000)'
pid: 8981

On the other terminal,
# service osa-dispatcher status
osa-dispatcher (pid 8981) is running...

Expected results:
# service rhn-satellite stop
# python -c 'import time; import os; print "pid: %d" % os.getpid() ; time.sleep(1000)'
pid: 8981

On the other terminal,
# service osa-dispatcher status
osa-dispatcher is stopped

Additional Info:
We have a few problems in both /etc/init.d/osa-dispatcher 
and /etc/init.d/functions.
This event sent from IssueTracker by mpoole  [Support Engineering Group]
 issue 231333

--- Additional comment from mpoole@redhat.com on 2008-10-22 12:01:56 EDT ---

This problem applies to both osad and osa-dispatcher.

The init.d scripts use the following to check the status of the running daemon

  status  "python $prog"

But, due to the use of pidof(1) in the underlying coding of status (from initscripts) there is no mechanism to detect anything other than "python" as running.

As the reproducer notes, just running a simple script that calls python is enough to fool the status.
Comment 1 Michael Mráka 2008-11-10 09:57:14 EST
'service osa-dispatcher status' works on RHEL5 so the problem remains only in /etc/init.d/functions on RHEL4.

initscripts-7.93.33-1.el4
osa-dispatche is http://porkchop.devel.redhat.com/brewroot/packages/osad/0.3.2/1.el4/noarch/osa-dispatcher-0.3.2-1.el4.noarch.rpm
Comment 2 Bill Nottingham 2008-11-10 14:26:01 EST
Are you running the latest sysvinit for RHEL 4?
Comment 3 Michael Mráka 2008-11-11 03:52:13 EST
Yes.

[root@xen81 ~]# rpm -q initscripts SysVinit
initscripts-7.93.33-1.el4.x86_64
SysVinit-2.85-34.4.x86_64
[root@xen81 ~]#  up2date -u initscripts SysVinit
Fetching Obsoletes list for channel: rhel-x86_64-as-4...
########################################
Fetching rpm headers...
Name                                    Version        Rel     
----------------------------------------------------------

All packages are currently up to date
Comment 4 Bill Nottingham 2009-01-27 11:38:27 EST
Sorry about the delay.

Passing arguments with a space isn't supposed to work; pidof only takes a particular program name, not a full commandline.

The algorithm used in pidof was rewritten upstream between 2.8.5 (in RHEL 4) and 2.86 (in RHEL 5). Given the chance of a regression elsewhere, and the current stage of RHEL 4's lifecycle, this is unlikely to be fixed there.

However, you should be able to fix this in satellite: if you just call 'status osa-disapatcher', or 'status /usr/sbin/osa-dispatcher', it should work in RHEL 4 as long as you run it directly as /usr/sbin/osa-dispatcher (not python /usr/sbin/osa-disaptcher)..

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