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

Dear Maintainer,

When using initctl utilities, they default to executing against system
upstart (typically pid 1), however if UPSTART_SESSION environment
variable is set, initctl defaults to operating against user-session
upstart (not very common on Debian desktops, but very common on ubuntu
desktops). Under such conditions, invoke-rc.d and service command should
operate against system upstart. With recent initctl one can use
'--system' command line option, but to stay compatible with initctl in
stable, i'm instead opting to unseting UPSTART_SESSION variable to
guarantee default execution against system upstart.

Regards,

Dimitri.

>From 8873e8eb1c569079d0e68de729cb1c2fd959aa91 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <x...@ubuntu.com>
Date: Sun, 20 Apr 2014 19:02:39 +0100
Subject: [PATCH 2/2] service & invoke-rc.d: use system upstart only.

service & invoke-rc.d: unset UPSTART_SESSION environment variable to
make sure all upstart initctl commands are executed against system
init and not the session one.
---
 debian/changelog                    | 3 +++
 debian/service/service              | 2 ++
 debian/src/sysv-rc/sbin/invoke-rc.d | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 01540bf..485cbd3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,9 @@ sysvinit (2.88dsf-55) UNRELEASED; urgency=medium
     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.
+  * service & invoke-rc.d: unset UPSTART_SESSION environment variable to
+    make sure all upstart initctl commands are executed against system
+    init and not the session one.
 
  -- Gabriele Giacone <1o5g4...@gmail.com>  Mon, 07 Apr 2014 12:59:55 +0200
 
diff --git a/debian/service/service b/debian/service/service
index feef474..387420a 100755
--- a/debian/service/service
+++ b/debian/service/service
@@ -129,6 +129,8 @@ while [ $# -gt 0 ]; do
    esac
 done
 
+# Operate against system upstart, not session
+unset UPSTART_SESSION
 if [ -r "/etc/init/${SERVICE}.conf" ] && which initctl >/dev/null \
    && initctl version 2>/dev/null | grep -q upstart \
    && initctl status ${SERVICE} 2>/dev/null 1>/dev/null
diff --git a/debian/src/sysv-rc/sbin/invoke-rc.d b/debian/src/sysv-rc/sbin/invoke-rc.d
index 88b178e..cdfc8d8 100644
--- a/debian/src/sysv-rc/sbin/invoke-rc.d
+++ b/debian/src/sysv-rc/sbin/invoke-rc.d
@@ -267,6 +267,8 @@ case ${ACTION} in
 	;;
 esac
 
+# Operate against system upstart, not session
+unset UPSTART_SESSION
 # 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 \
-- 
1.9.1

Reply via email to