Merge lp:~jamesodhunt/upstart/bug-1222705 into lp:upstart

Proposed by James Hunt on 2014-01-31
Status: Merged
Merged at revision: 1602
Proposed branch: lp:~jamesodhunt/upstart/bug-1222705
Merge into: lp:upstart
Diff against target: 181 lines (+86/-2)
3 files modified
ChangeLog (+7/-0)
init/job_class.c (+3/-2)
init/tests/test_job_class.c (+76/-0)
To merge this branch: bzr merge lp:~jamesodhunt/upstart/bug-1222705
Reviewer Review Type Date Requested Status
Upstart Reviewers 2014-01-31 Pending
Review via email: mp+204222@code.launchpad.net
To post a comment you must log in.
lp:~jamesodhunt/upstart/bug-1222705 updated on 2014-03-05
1593. By James Hunt on 2014-02-04

* extra/man/socket-event.7: Environment variable is UPSTART_EVENTS, not
  UPSTART_JOB (LP: #1275308).

1594. By James Hunt on 2014-02-19

* Merged lp:~cameronnemo/upstart/ipv6.

1595. By Dimitri John Ledkov on 2014-03-05

Merge lp:~jamesodhunt/upstart/fix-python-tests

1596. By James Hunt on 2014-03-05

* Merged lp:~xnox/upstart/pyflakes3.

1597. By James Hunt on 2014-03-05

* doc/states.dot: Added missing security state.

1598. By Dimitri John Ledkov on 2014-03-05

Merge lp:~jamesodhunt/upstart/test-upstart-name

1599. By Dimitri John Ledkov on 2014-03-05

merge lp:~jamesodhunt/upstart/fix-job_find

1600. By Dimitri John Ledkov on 2014-03-05

merge lp:~jamesodhunt/upstart/use-session-init-for-init-checkconf

1601. By Dimitri John Ledkov on 2014-03-05

update unit test-names expectations, init during unit-tests is now named test_init

Dimitri John Ledkov (xnox) wrote :

Looks good, I wish we had "Blocks (C language extension)" in gcc =/

lp:~jamesodhunt/upstart/bug-1222705 updated on 2014-03-05
1602. By Dimitri John Ledkov on 2014-03-05

merge lp:~jamesodhunt/upstart/bug-1222705

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2014-01-22 11:16:20 +0000
3+++ ChangeLog 2014-01-31 12:43:20 +0000
4@@ -1,3 +1,10 @@
5+2014-01-31 James Hunt <james.hunt@ubuntu.com>
6+
7+ * init/job_class.c: job_class_stop(): Copy env rather than
8+ referencing a local variable (LP: #1222705).
9+ * init/tests/test_job_class.c: test_start(), test_stop(),
10+ test_restart(): Check job->env, job->start_env and job->stop-env.
11+
12 2014-01-22 James Hunt <james.hunt@ubuntu.com>
13
14 * init/main.c: logger_kmsg(): Use open(2) rather than fopen(3) to avoid
15
16=== modified file 'init/job_class.c'
17--- init/job_class.c 2014-01-17 12:03:24 +0000
18+++ init/job_class.c 2014-01-31 12:43:20 +0000
19@@ -1241,8 +1241,9 @@
20 if (job->stop_env)
21 nih_unref (job->stop_env, job);
22
23- job->stop_env = (char **)env;
24- nih_ref (job->stop_env, job);
25+ job->stop_env = nih_str_array_copy (job, NULL, env);
26+ if (! job->stop_env)
27+ nih_return_system_error (-1);
28
29 job_finished (job, FALSE);
30 if (blocked)
31
32=== modified file 'init/tests/test_job_class.c'
33--- init/tests/test_job_class.c 2013-07-21 23:54:16 +0000
34+++ init/tests/test_job_class.c 2014-01-31 12:43:20 +0000
35@@ -1569,6 +1569,16 @@
36 TEST_EQ (job->goal, JOB_START);
37 TEST_EQ (job->state, JOB_STARTING);
38
39+ TEST_EQ_P (job->start_env, NULL);
40+ TEST_EQ_P (job->stop_env, NULL);
41+
42+ TEST_NE_P (job->env, NULL);
43+ TEST_EQ_STRN (job->env[0], "PATH=");
44+ TEST_EQ_STRN (job->env[1], "TERM=");
45+ TEST_EQ_P (job->env[2], NULL);
46+
47+ TEST_NE_P (job->env, env);
48+
49 TEST_LIST_NOT_EMPTY (&job->blocking);
50
51 blocked = (Blocked *)job->blocking.next;
52@@ -1664,6 +1674,15 @@
53
54 TEST_LIST_EMPTY (&job->blocking);
55
56+ TEST_EQ_P (job->start_env, NULL);
57+ TEST_EQ_P (job->stop_env, NULL);
58+
59+ TEST_NE_P (job->env, NULL);
60+ TEST_EQ_STRN (job->env[0], "PATH=");
61+ TEST_EQ_STRN (job->env[1], "TERM=");
62+ TEST_EQ_P (job->env[2], NULL);
63+
64+ TEST_NE_P (job->env, env);
65
66 dbus_connection_flush (conn);
67
68@@ -1746,6 +1765,16 @@
69 TEST_EQ (job->goal, JOB_START);
70 TEST_EQ (job->state, JOB_STOPPING);
71
72+ TEST_EQ_P (job->env, NULL);
73+ TEST_EQ_P (job->stop_env, NULL);
74+
75+ TEST_NE_P (job->start_env, NULL);
76+ TEST_EQ_STRN (job->start_env[0], "PATH=");
77+ TEST_EQ_STRN (job->start_env[1], "TERM=");
78+ TEST_EQ_P (job->start_env[2], NULL);
79+
80+ TEST_NE_P (job->start_env, env);
81+
82 TEST_LIST_NOT_EMPTY (&job->blocking);
83
84 blocked = (Blocked *)job->blocking.next;
85@@ -1906,12 +1935,18 @@
86 TEST_EQ (job->goal, JOB_START);
87 TEST_EQ (job->state, JOB_STARTING);
88
89+ TEST_NE_P (job->start_env, env);
90+ TEST_NE_P (job->stop_env, env);
91+
92+ TEST_NE_P (job->env, NULL);
93 TEST_EQ_STRN (job->env[0], "PATH=");
94 TEST_EQ_STRN (job->env[1], "TERM=");
95 TEST_EQ_STR (job->env[2], "FOO=wibble");
96 TEST_EQ_STR (job->env[3], "BAR=wobble");
97 TEST_EQ_P (job->env[4], NULL);
98
99+ TEST_NE_P (job->env, env);
100+
101 TEST_LIST_NOT_EMPTY (&job->blocking);
102
103 blocked = (Blocked *)job->blocking.next;
104@@ -2087,6 +2122,14 @@
105
106 TEST_NOT_FREE (job);
107
108+ TEST_EQ_P (job->env, NULL);
109+ TEST_EQ_P (job->start_env, NULL);
110+
111+ TEST_NE_P (job->stop_env, NULL);
112+ TEST_EQ_P (job->stop_env[0], NULL);
113+
114+ TEST_NE_P (job->stop_env, env);
115+
116 TEST_EQ (job->goal, JOB_STOP);
117 TEST_EQ (job->state, JOB_STOPPING);
118
119@@ -2177,6 +2220,13 @@
120
121 TEST_LIST_EMPTY (&job->blocking);
122
123+ TEST_EQ_P (job->env, NULL);
124+ TEST_EQ_P (job->start_env, NULL);
125+
126+ TEST_NE_P (job->stop_env, NULL);
127+ TEST_EQ_P (job->stop_env[0], NULL);
128+
129+ TEST_NE_P (job->stop_env, env);
130
131 dbus_connection_flush (conn);
132
133@@ -2354,10 +2404,16 @@
134 TEST_EQ (job->goal, JOB_STOP);
135 TEST_EQ (job->state, JOB_STOPPING);
136
137+ TEST_EQ_P (job->env, NULL);
138+ TEST_EQ_P (job->start_env, NULL);
139+
140+ TEST_NE_P (job->stop_env, NULL);
141 TEST_EQ_STR (job->stop_env[0], "FOO=wibble");
142 TEST_EQ_STR (job->stop_env[1], "BAR=wobble");
143 TEST_EQ_P (job->stop_env[2], NULL);
144
145+ TEST_NE_P (job->stop_env, env);
146+
147 TEST_LIST_NOT_EMPTY (&job->blocking);
148
149 blocked = (Blocked *)job->blocking.next;
150@@ -2527,6 +2583,16 @@
151 TEST_EQ (job->goal, JOB_START);
152 TEST_EQ (job->state, JOB_STOPPING);
153
154+ TEST_EQ_P (job->env, NULL);
155+ TEST_EQ_P (job->stop_env, NULL);
156+
157+ TEST_NE_P (job->start_env, NULL);
158+ TEST_EQ_STRN (job->start_env[0], "PATH=");
159+ TEST_EQ_STRN (job->start_env[1], "TERM=");
160+ TEST_EQ_P (job->start_env[2], NULL);
161+
162+ TEST_NE_P (job->start_env, env);
163+
164 TEST_LIST_NOT_EMPTY (&job->blocking);
165
166 blocked = (Blocked *)job->blocking.next;
167@@ -2626,6 +2692,16 @@
168 TEST_EQ (job->goal, JOB_START);
169 TEST_EQ (job->state, JOB_STOPPING);
170
171+ TEST_EQ_P (job->env, NULL);
172+ TEST_EQ_P (job->stop_env, NULL);
173+
174+ TEST_NE_P (job->start_env, NULL);
175+ TEST_EQ_STRN (job->start_env[0], "PATH=");
176+ TEST_EQ_STRN (job->start_env[1], "TERM=");
177+ TEST_EQ_P (job->start_env[2], NULL);
178+
179+ TEST_NE_P (job->start_env, env);
180+
181 TEST_LIST_EMPTY (&job->blocking);
182
183

Subscribers

People subscribed via source and target branches