[Bug 806677] Re: status_of_proc returns incorrect number

Jacob Smith 806677 at bugs.launchpad.net
Thu Jul 7 14:36:04 UTC 2011


I tried some further testing and comparison today:

I looked through the init script for NTP and how it calls status_of_proc
and my patch for Arpwatch looks identical. However if ntp is not running
and you execute /etc/init.d/ntp status; echo "return $?" you get return
3 which is the proper response per LSB standard. But if you execute the
same with my patched Arpwatch script - /etc/init.d/arpwatch status; echo
"return $?" you get return 0...

Not sure what I'm missing or if it's really a problem in init-
functions...

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to lsb in Ubuntu.
https://bugs.launchpad.net/bugs/806677

Title:
  status_of_proc returns incorrect number

Status in “lsb” package in Ubuntu:
  New

Bug description:
  I was patching the init script for Arpwatch so that it would be LSB
  compliant (adding status) and came across this issue.  I believe it
  differs from the similarly named bug with code 3/4 problems.

  Arpwatch not running.  Using the status_of_proc function.  Return code
  is 0.  According to the LSB standard it should be a return code 3.  In
  the pidofproc() section the match is on line 97 which in turn returns
  code 3 on line 98.  However when testing this pidofproc() function it
  first returns the 3 from line 98 and then it returns 0 from line 100.
  No idea why it returns 0 after returning 3? And then if it returned 0
  why is it matching on the final else in status_of_proc (anything but 0
  or 4?) lines 183/184?

      if [ -x /bin/pidof -a ! "$specified" ]; then
          status="0"
          /bin/pidof -o %PPID -x $1 || status="$?"
          if [ "$status" = 1 ]; then
              return 3 # program is not running
          fi
          return 0
      fi

  The bug for the related Arpwatch package is LP: 806145.

  1) Description: Ubuntu 10.04.2 LTS
      Release: 10.04

  2)lsb-base:
    Installed: 4.0-0ubuntu8
    Candidate: 4.0-0ubuntu8
    Version table:
   *** 4.0-0ubuntu8 0
          500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
          100 /var/lib/dpkg/status

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/806677/+subscriptions




More information about the foundations-bugs mailing list