122-upstream-bash43-022.patch (1453B)
1 BASH PATCH REPORT 2 ================= 3 4 Bash-Release: 4.3 5 Patch-ID: bash43-022 6 7 Bug-Reported-by: scorp.dev.null@gmail.com 8 Bug-Reference-ID: <E1WxXw8-0007iE-Bi@pcm14> 9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00061.html 10 11 Bug-Description: 12 13 Using nested pipelines within loops with the `lastpipe' option set can result 14 in a segmentation fault. 15 16 Patch (apply with `patch -p0'): 17 18 --- a/execute_cmd.c 19 +++ b/execute_cmd.c 20 @@ -2413,7 +2413,16 @@ execute_pipeline (command, asynchronous, 21 #endif 22 lstdin = wait_for (lastpid); 23 #if defined (JOB_CONTROL) 24 - exec_result = job_exit_status (lastpipe_jid); 25 + /* If wait_for removes the job from the jobs table, use result of last 26 + command as pipeline's exit status as usual. The jobs list can get 27 + frozen and unfrozen at inconvenient times if there are multiple pipelines 28 + running simultaneously. */ 29 + if (INVALID_JOB (lastpipe_jid) == 0) 30 + exec_result = job_exit_status (lastpipe_jid); 31 + else if (pipefail_opt) 32 + exec_result = exec_result | lstdin; /* XXX */ 33 + /* otherwise we use exec_result */ 34 + 35 #endif 36 unfreeze_jobs_list (); 37 } 38 --- a/patchlevel.h 39 +++ b/patchlevel.h 40 @@ -25,6 +25,6 @@ 41 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 42 looks for to find the patch level (for the sccs version string). */ 43 44 -#define PATCHLEVEL 21 45 +#define PATCHLEVEL 22 46 47 #endif /* _PATCHLEVEL_H_ */