diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-08 00:24:32 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-08 00:24:32 +0200 |
commit | 13102634bb38befd80fafb5d2ebd915d7dcf0c5f (patch) | |
tree | ff7700cf716b079a66e1a8c29ae1e5d86714f8d4 | |
parent | 840a4355d035efc360eeefe5da8a11e47b3c80d3 (diff) | |
download | busybox-w32-13102634bb38befd80fafb5d2ebd915d7dcf0c5f.tar.gz busybox-w32-13102634bb38befd80fafb5d2ebd915d7dcf0c5f.tar.bz2 busybox-w32-13102634bb38befd80fafb5d2ebd915d7dcf0c5f.zip |
hush: explain why wait5.tests is failing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/shell/hush.c b/shell/hush.c index df96e6fde..b131f6095 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -7401,6 +7401,10 @@ static int process_wait_result(struct pipe *fg_pipe, pid_t childpid, int status) | |||
7401 | printf(JOB_STATUS_FORMAT, pi->jobid, | 7401 | printf(JOB_STATUS_FORMAT, pi->jobid, |
7402 | "Done", pi->cmdtext); | 7402 | "Done", pi->cmdtext); |
7403 | delete_finished_bg_job(pi); | 7403 | delete_finished_bg_job(pi); |
7404 | //bash deletes finished jobs from job table only in interactive mode, after "jobs" cmd, | ||
7405 | //or if pid of a new process matches one of the old ones | ||
7406 | //(see cleanup_dead_jobs(), delete_old_job(), J_NOTIFIED in bash source). | ||
7407 | //Testcase script: "(exit 3) & sleep 1; wait %1; echo $?" prints 3 in bash. | ||
7404 | } | 7408 | } |
7405 | } else { | 7409 | } else { |
7406 | /* child stopped */ | 7410 | /* child stopped */ |
@@ -9899,6 +9903,15 @@ static int FAST_FUNC builtin_wait(char **argv) | |||
9899 | ret = job_exited_or_stopped(wait_pipe); | 9903 | ret = job_exited_or_stopped(wait_pipe); |
9900 | if (ret < 0) | 9904 | if (ret < 0) |
9901 | ret = wait_for_child_or_signal(wait_pipe, 0); | 9905 | ret = wait_for_child_or_signal(wait_pipe, 0); |
9906 | //bash immediately deletes finished jobs from job table only in interactive mode, | ||
9907 | //we _always_ delete them at once. If we'd start doing that, this (and more) | ||
9908 | //would be necessary to avoid accumulating dead jobs: | ||
9909 | # if 0 | ||
9910 | else { | ||
9911 | if (!wait_pipe->alive_cmds) | ||
9912 | delete_finished_bg_job(wait_pipe); | ||
9913 | } | ||
9914 | # endif | ||
9902 | } | 9915 | } |
9903 | /* else: parse_jobspec() already emitted error msg */ | 9916 | /* else: parse_jobspec() already emitted error msg */ |
9904 | continue; | 9917 | continue; |