On 6/19/14, 4:43 AM, scorp.dev.n...@gmail.com wrote: > Bash Version: 4.2 > Patch Level: 45 > Release Status: release > > Description: > > in case use overwrite variables within "while loop" in lastpipe mode i get > "Segmentation fault"
Thanks for the report. The lastpipe code needs to be more careful checking whether or not the jobs list has not been modified. I've attached a patch to bash-4.3 that fixes the problem. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.3-patched/execute_cmd.c 2014-01-31 10:54:52.000000000 -0500 --- execute_cmd.c 2014-06-19 08:05:49.000000000 -0400 *************** *** 2410,2414 **** lstdin = wait_for (lastpid); #if defined (JOB_CONTROL) ! exec_result = job_exit_status (lastpipe_jid); #endif unfreeze_jobs_list (); --- 2425,2438 ---- lstdin = wait_for (lastpid); #if defined (JOB_CONTROL) ! /* If wait_for removes the job from the jobs table, use result of last ! command as pipeline's exit status as usual. The jobs list can get ! frozen and unfrozen at inconvenient times if there are multiple pipelines ! running simultaneously. */ ! if (INVALID_JOB (lastpipe_jid) == 0) ! exec_result = job_exit_status (lastpipe_jid); ! else if (pipefail_opt) ! exec_result = exec_result | lstdin; /* XXX */ ! /* otherwise we use exec_result */ ! #endif unfreeze_jobs_list ();