Merge lp:~xnox/upstart/async-remove-duplicate-event into lp:upstart/async

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1654
Proposed branch: lp:~xnox/upstart/async-remove-duplicate-event
Merge into: lp:upstart/async
Prerequisite: lp:~xnox/upstart/async-kill-sync-spawn
Diff against target: 75 lines (+6/-21)
3 files modified
init/job.c (+2/-17)
init/job.h (+0/-2)
init/tests/test_event.c (+4/-2)
To merge this branch: bzr merge lp:~xnox/upstart/async-remove-duplicate-event
Reviewer Review Type Date Requested Status
James Hunt Approve
Review via email: mp+220542@code.launchpad.net

This proposal supersedes a proposal from 2014-05-21.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote : Posted in a previous version of this proposal
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

ISSUE #1:
 1733 //FIXME must run without TEST_ALLOC_SAFE
 1734 TEST_ALLOC_SAFE {
 1735 event_poll ();
 1736 }

Deeply puzzled by this one:

Memory allocation fails during:
job->process_data = nih_alloc (...)
we then free the job:
nih_free (job);
jump to job_destory:
nih_list_destroy (&job->entry)

And get a segfault here....

Revision history for this message
James Hunt (jamesodhunt) wrote :

OK, merging this for now since tests works as-is (for me). We can raise a follow-on to address the issue.

Revision history for this message
James Hunt (jamesodhunt) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'init/job.c'
2--- init/job.c 2014-05-21 22:58:41 +0000
3+++ init/job.c 2014-05-21 22:58:41 +0000
4@@ -978,23 +978,8 @@
5
6
7 /**
8- * job_emit_event:
9- * @job: job generating the event,
10- *
11- * Compat function, for migration to job_emit_event_with_state.
12- *
13- * Returns: new Event in the queue.
14- **/
15-Event *
16-job_emit_event (Job *job)
17-{
18- return job_emit_event_with_state (job, job->state);
19-}
20-
21-/**
22 * job_emit_event_with_state:
23 * @job: job generating the event,
24- * @state: state job is moving to.
25 *
26 * Called from a state change because it believes an event should be
27 * emitted. Constructs the event with the right arguments and environment
28@@ -1012,7 +997,7 @@
29 * Returns: new Event in the queue.
30 **/
31 Event *
32-job_emit_event_with_state (Job *job, JobState state)
33+job_emit_event (Job *job)
34 {
35 Event *event;
36 const char *name;
37@@ -1023,7 +1008,7 @@
38
39 nih_assert (job != NULL);
40
41- switch (state) {
42+ switch (job->state) {
43 case JOB_STARTING:
44 name = JOB_STARTING_EVENT;
45 block = TRUE;
46
47=== modified file 'init/job.h'
48--- init/job.h 2014-05-16 12:12:20 +0000
49+++ init/job.h 2014-05-21 22:58:41 +0000
50@@ -238,8 +238,6 @@
51 void job_finished (Job *job, int failed);
52
53 Event *job_emit_event (Job *job);
54-Event *job_emit_event_with_state (Job *job, JobState state);
55-
56
57 const char *job_name (Job *job);
58
59
60=== modified file 'init/tests/test_event.c'
61--- init/tests/test_event.c 2014-05-19 16:52:28 +0000
62+++ init/tests/test_event.c 2014-05-21 22:58:41 +0000
63@@ -1730,8 +1730,10 @@
64 nih_hash_add (job_classes, &class->entry);
65 }
66
67- event_poll ();
68-
69+ //FIXME must run without TEST_ALLOC_SAFE
70+ TEST_ALLOC_SAFE {
71+ event_poll ();
72+ }
73 TEST_FREE (event);
74
75 TEST_HASH_NOT_EMPTY (class->instances);

Subscribers

People subscribed via source and target branches