Merge lp:~vorlon/upstart/lp.855010 into lp:upstart

Proposed by Steve Langasek
Status: Needs review
Proposed branch: lp:~vorlon/upstart/lp.855010
Merge into: lp:upstart
Diff against target: 71 lines (+12/-20)
3 files modified
ChangeLog (+6/-0)
init/job_process.c (+4/-18)
init/tests/test_job_process.c (+2/-2)
To merge this branch: bzr merge lp:~vorlon/upstart/lp.855010
Reviewer Review Type Date Requested Status
James Hunt Pending
Review via email: mp+95078@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

1358. By Steve Langasek

don't treat exec as a sign to stop tracing; in some unusual cases (i.e.,
cups), a process may actually re-exec itself before forking.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2012-02-13 12:08:33 +0000
+++ ChangeLog 2012-02-28 23:37:19 +0000
@@ -1,3 +1,9 @@
12012-02-28 Steve Langasek <steve.langasek@ubuntu.com>
2
3 * init/job_process.c: don't treat exec as a sign to stop tracing; in
4 some unusual cases (i.e., cups), a process may actually re-exec
5 itself before forking.
6
12012-02-13 James Hunt <james.hunt@ubuntu.com>72012-02-13 James Hunt <james.hunt@ubuntu.com>
28
3 * init/log.c:9 * init/log.c:
410
=== modified file 'init/job_process.c'
--- init/job_process.c 2012-02-03 13:17:24 +0000
+++ init/job_process.c 2012-02-28 23:37:19 +0000
@@ -1934,9 +1934,6 @@
1934 * This function is called whenever a traced @process attached to @job calls1934 * This function is called whenever a traced @process attached to @job calls
1935 * the exec() system call after we've set options on it to distinguish them1935 * the exec() system call after we've set options on it to distinguish them
1936 * from ordinary SIGTRAPs.1936 * from ordinary SIGTRAPs.
1937 *
1938 * We assume that if the job calls exec that it's finished forking so we can
1939 * drop the trace entirely; we have no interest in tracing the new child.
1940 **/1937 **/
1941static void1938static void
1942job_process_trace_exec (Job *job,1939job_process_trace_exec (Job *job,
@@ -1954,21 +1951,10 @@
1954 nih_info (_("%s %s process (%d) executable changed"),1951 nih_info (_("%s %s process (%d) executable changed"),
1955 job_name (job), process_name (process), job->pid[process]);1952 job_name (job), process_name (process), job->pid[process]);
19561953
1957 if (job->trace_forks) {1954 if (ptrace (PTRACE_CONT, job->pid[process], NULL, 0) < 0)
1958 if (ptrace (PTRACE_DETACH, job->pid[process], NULL, 0) < 0)1955 nih_warn (_("Failed to continue traced %s %s process (%d): %s"),
1959 nih_warn (_("Failed to detach traced "1956 job_name (job), process_name (process),
1960 "%s %s process (%d): %s"),1957 job->pid[process], strerror (errno));
1961 job_name (job), process_name (process),
1962 job->pid[process], strerror (errno));
1963
1964 job->trace_state = TRACE_NONE;
1965 job_change_state (job, job_next_state (job));
1966 } else {
1967 if (ptrace (PTRACE_CONT, job->pid[process], NULL, 0) < 0)
1968 nih_warn (_("Failed to continue traced %s %s process (%d): %s"),
1969 job_name (job), process_name (process),
1970 job->pid[process], strerror (errno));
1971 }
1972}1958}
19731959
19741960
19751961
=== modified file 'init/tests/test_job_process.c'
--- init/tests/test_job_process.c 2012-02-13 12:08:33 +0000
+++ init/tests/test_job_process.c 2012-02-28 23:37:19 +0000
@@ -8145,11 +8145,11 @@
8145 rewind (output);8145 rewind (output);
81468146
8147 TEST_EQ (job->goal, JOB_START);8147 TEST_EQ (job->goal, JOB_START);
8148 TEST_EQ (job->state, JOB_RUNNING);8148 TEST_EQ (job->state, JOB_SPAWNED);
8149 TEST_EQ (job->pid[PROCESS_MAIN], pid);8149 TEST_EQ (job->pid[PROCESS_MAIN], pid);
81508150
8151 TEST_EQ (job->trace_forks, 1);8151 TEST_EQ (job->trace_forks, 1);
8152 TEST_EQ (job->trace_state, TRACE_NONE);8152 TEST_EQ (job->trace_state, TRACE_NORMAL);
81538153
8154 waitpid (job->pid[PROCESS_MAIN], &status, 0);8154 waitpid (job->pid[PROCESS_MAIN], &status, 0);
8155 TEST_TRUE (WIFEXITED (status));8155 TEST_TRUE (WIFEXITED (status));

Subscribers

People subscribed via source and target branches