[Bug 1511628] Re: invoke-rc.d uses incorrect exit code

Steve Langasek steve.langasek at canonical.com
Fri Oct 30 15:40:44 UTC 2015


invoke-rc.d is an interface for package maintainer scripts to manipulate
services, as described in Debian policy; it is almost never the correct
interface for other tools to use.  Returning 0 when a service is not
restarted because masked is the correct behavior for this interface.

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

Title:
  invoke-rc.d uses incorrect exit code

Status in sysvinit package in Ubuntu:
  New

Bug description:
  I am using invoke-rc.d on Vivid and have observed what appears to be
  incorrect behavior. I have a systemd service installed that is masked
  and I am attempting to use invoke-rc.d to obtain its status.

  However, the exit code is 0, which falsely suggests that the service
  is running. If I run "systemctl status myservice" directly for the
  masked service, the exit code is 3, as expected.

  This makes it impossible to determine if the service is in fact
  running without resorting to systemd commands. I'm developing a
  package that runs on releases that use init and releases that use
  systemd. The packaging includes an init script and a systemd unit
  file. I need an "init-agnostic" command for restarting the service in
  the .logrotate file.

  I dug a bit into the source code and found that line 407 contains
  "exit 0". I don't understand why anyone would want the return code for
  a running service and a masked service to be identical. I assume this
  is a bug.

  ProblemType: Bug
  DistroRelease: Ubuntu 15.04
  Package: sysv-rc 2.88dsf-53.2ubuntu12
  ProcVersionSignature: Ubuntu 3.19.0-30.34-generic 3.19.8-ckt6
  Uname: Linux 3.19.0-30-generic x86_64
  ApportVersion: 2.17.2-0ubuntu1.5
  Architecture: amd64
  CurrentDesktop: Unity
  Date: Thu Oct 29 23:37:05 2015
  InstallationDate: Installed on 2015-06-01 (150 days ago)
  InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
  PackageArchitecture: all
  SourcePackage: sysvinit
  UpgradeStatus: Upgraded to vivid on 2015-10-22 (7 days ago)

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



More information about the foundations-bugs mailing list