Package: sysv-rc
Version: 2.88dsf-53
Severity: normal
Tags: patch

Dear Maintainer,

When integrating with upstart, just checking that /etc/init/$job.conf
exists is not enough. One should also query, via "initctl status" if
upstart indeed knows about the job. For example, newly introduced job
file (stable/testing) may contain stanzas which will be known to newer
upstart (stable/testing), but not the currently running one (old-stable)
and thus initd script should be used instead.

Regards,

Dimitri.

>From 524722835e7a9c87e8ffda1a3c936233bb50c076 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <[email protected]>
Date: Sun, 20 Apr 2014 18:55:14 +0100
Subject: [PATCH 1/2] service & invoke-rc.d: check that jobs are known to
 upstart.

service & invoke-rc.d: in upstart interfacing code, check that the job
is actually known to upstart. This is because during upgrades, pid 1
might still be an older upstart which may not yet support syntax of
the newly unpacked jobs, thus sysv-init script should be continued to
be used instead.
---
 debian/changelog                    | 8 ++++++++
 debian/service/service              | 3 ++-
 debian/src/sysv-rc/sbin/invoke-rc.d | 3 +--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index da2aa18..01540bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,18 @@
 sysvinit (2.88dsf-55) UNRELEASED; urgency=medium
 
+  [ Gabriele Giacone ]
   * sysv-rc:
     - On hurd, fix hurd-console addition to inittab if inittab is already
       existent and fix getty pathnames in commented out lines as well
       (Closes: #745260).
 
+  [ Dimitri John Ledkov ]
+  * service & invoke-rc.d: in upstart interfacing code, check that the job
+    is actually known to upstart. This is because during upgrades, pid 1
+    might still be an older upstart which may not yet support syntax of
+    the newly unpacked jobs, thus sysv-init script should be continued to
+    be used instead.
+
  -- Gabriele Giacone <[email protected]>  Mon, 07 Apr 2014 12:59:55 +0200
 
 sysvinit (2.88dsf-54) experimental; urgency=medium
diff --git a/debian/service/service b/debian/service/service
index a9776e0..feef474 100755
--- a/debian/service/service
+++ b/debian/service/service
@@ -130,7 +130,8 @@ while [ $# -gt 0 ]; do
 done
 
 if [ -r "/etc/init/${SERVICE}.conf" ] && which initctl >/dev/null \
-   && initctl version 2>/dev/null | grep -q upstart
+   && initctl version 2>/dev/null | grep -q upstart \
+   && initctl status ${SERVICE} 2>/dev/null 1>/dev/null
 then
    # Upstart configuration exists for this job and we're running on upstart
    case "${ACTION}" in
diff --git a/debian/src/sysv-rc/sbin/invoke-rc.d b/debian/src/sysv-rc/sbin/invoke-rc.d
index f03bf5d..88b178e 100644
--- a/debian/src/sysv-rc/sbin/invoke-rc.d
+++ b/debian/src/sysv-rc/sbin/invoke-rc.d
@@ -24,7 +24,6 @@
 RUNLEVELHELPER=/sbin/runlevel
 POLICYHELPER=/usr/sbin/policy-rc.d
 INITDPREFIX=/etc/init.d/
-UPSTARTDIR=/etc/init/
 RCDPREFIX=/etc/rc
 
 # Options
@@ -271,7 +270,7 @@ esac
 # If we're running on upstart and there's an upstart job of this name, do
 # the rest with upstart instead of calling the init script.
 if which initctl >/dev/null && initctl version 2>/dev/null | grep -q upstart \
-   && [ -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]
+   && inictl status ${INITSCRIPTID} 1>/dev/null 2>/dev/null
 then
     is_upstart=1
 elif test -d /run/systemd/system ; then
-- 
1.9.1

_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-sysvinit-devel

Reply via email to