Merge lp:~jamesodhunt/ubuntu/natty/upstart/fix-for-770532 into lp:ubuntu/natty/upstart

Proposed by James Hunt
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~jamesodhunt/ubuntu/natty/upstart/fix-for-770532
Merge into: lp:ubuntu/natty/upstart
Diff against target: 119 lines (+47/-7)
4 files modified
ChangeLog (+10/-0)
debian/changelog (+7/-0)
scripts/init-checkconf.sh (+23/-7)
scripts/man/init-checkconf.8 (+7/-0)
To merge this branch: bzr merge lp:~jamesodhunt/ubuntu/natty/upstart/fix-for-770532
Reviewer Review Type Date Requested Status
Stéphane Graber merged Approve
Ubuntu branches Pending
Review via email: mp+59348@code.launchpad.net

Description of the change

Fixed bug 770532.

To post a comment you must log in.
Revision history for this message
Stéphane Graber (stgraber) :
review: Approve (merged)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2011-04-20 16:45:43 +0000
3+++ ChangeLog 2011-04-28 10:58:26 +0000
4@@ -1,3 +1,13 @@
5+2011-04-27 James Hunt <james.hunt@ubuntu.com>
6+
7+ * scripts/init-checkconf.sh:
8+ - New function upstart_running.
9+ - We now check to ensure no other instance running.
10+ - Use list command rather than status since the latter requires an
11+ instance variable to be specified (LP: #770532).
12+ - Improve cleanup safety.
13+ * scripts/man/init-checkconf.8: Added limitations section.
14+
15 2011-04-20 James Hunt <james.hunt@ubuntu.com>
16
17 * control_get_job_by_name: Fix to relax session rigidity for user
18
19=== modified file 'debian/changelog'
20--- debian/changelog 2011-04-20 16:45:43 +0000
21+++ debian/changelog 2011-04-28 10:58:26 +0000
22@@ -1,3 +1,10 @@
23+upstart (0.9.7-2) natty; urgency=low
24+
25+ * Merge of upstream lp:~upstart-devel/upstart/0.9: Updates for
26+ init-checkconf.
27+
28+ -- James Hunt <james.hunt@ubuntu.com> Wed, 27 Apr 2011 15:19:47 +0100
29+
30 upstart (0.9.7-1) natty; urgency=low
31
32 * New upstream release 0.9.7: Important session fix (LP: #767053).
33
34=== modified file 'scripts/init-checkconf.sh'
35--- scripts/init-checkconf.sh 2011-04-06 16:35:39 +0000
36+++ scripts/init-checkconf.sh 2011-04-28 10:58:26 +0000
37@@ -37,8 +37,13 @@
38
39 cleanup()
40 {
41- kill -0 "$upstart_pid" >/dev/null 2>&1 && \
42- kill -9 "$upstart_pid" >/dev/null 2>&1
43+ if [ ! -z "$upstart_pid" ]
44+ then
45+ debug "stopping secondary Upstart (running with PID $upstart_pid)"
46+ kill -0 "$upstart_pid" >/dev/null 2>&1 && \
47+ kill -9 "$upstart_pid" >/dev/null 2>&1
48+ fi
49+
50 [ -d "$confdir" ] && rm -rf "$confdir"
51 [ $file_valid = y ] && exit 0
52 exit 1
53@@ -86,6 +91,15 @@
54 exit 1
55 }
56
57+# Return 0 if Upstart is running on the D-Bus session bus, else 1.
58+upstart_running()
59+{
60+ dbus-send --session --print-reply \
61+ --dest='com.ubuntu.Upstart' /com/ubuntu/Upstart \
62+ org.freedesktop.DBus.Properties.GetAll \
63+ string:'com.ubuntu.Upstart0_6' >/dev/null 2>&1
64+}
65+
66 trap cleanup EXIT INT TERM
67
68 args=$(getopt \
69@@ -171,6 +185,10 @@
70 cp "$file" "$confdir"
71 debug "job=$job"
72
73+upstart_running
74+[ $? -eq 0 ] && die "Another instance of this program is already running"
75+debug "ok - no other running instances detected"
76+
77 upstart_out="$(mktemp --tmpdir "${script_name}-upstart-output.XXXXXXXXXX")"
78 debug "upstart_out=$upstart_out"
79
80@@ -191,10 +209,7 @@
81 for i in $(seq 1 5)
82 do
83 debug "Waiting for Upstart to reply over D-Bus (attempt $i)"
84- dbus-send --session --print-reply \
85- --dest='com.ubuntu.Upstart' /com/ubuntu/Upstart \
86- org.freedesktop.DBus.Properties.GetAll \
87- string:'com.ubuntu.Upstart0_6' >/dev/null 2>&1
88+ upstart_running
89 if [ $? -eq 0 ]
90 then
91 running=y
92@@ -221,7 +236,8 @@
93 done
94 fi
95
96-if "$initctl_path" --session status "$job" >/dev/null 2>&1
97+"$initctl_path" --session list|grep -q "^${job}"
98+if [ $? -eq 0 ]
99 then
100 file_valid=y
101 echo "File $file: syntax ok"
102
103=== modified file 'scripts/man/init-checkconf.8'
104--- scripts/man/init-checkconf.8 2011-04-06 16:35:39 +0000
105+++ scripts/man/init-checkconf.8 2011-04-28 10:58:26 +0000
106@@ -50,6 +50,13 @@
107 Written by James Hunt
108 .RB < james.hunt@ubuntu.com >
109 .\"
110+.SH LIMITATIONS
111+.IP \(bu 4
112+This program will not run as the root user.
113+.IP \(bu 4
114+It is not possible for a user to run multiple simultaneous
115+instances of this program.
116+.\"
117 .SH REPORTING BUGS
118 Report bugs at
119 .RB < https://launchpad.net/upstart/+bugs >

Subscribers

People subscribed via source and target branches

to all changes: