[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in patch bash42-018, leaves lastpipe_flag unitialized for platfo
Re: Bug in patch bash42-018, leaves lastpipe_flag unitialized for platforms with out JOB_CONTROL.
Thu, 21 Jun 2012 14:41:22 -0400
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120601 Thunderbird/13.0
On 6/21/12 8:42 AM, John E. Malmberg wrote:
> Hello Bash-bugs,
> The patch bash42-018 to allow execute_cmd.c that is supposed to allow it to
> compile with out JOB_CONTROL defined has a bug in it.
> It is leaving the lastpipe_flag uninitialized. This is a problem because
> later in the module it is tested.
> *** ../bash-4.2-patched/execute_cmd.c 2011-02-09 17:32:25.000000000 -0500
> --- execute_cmd.c 2011-11-06 15:12:48.000000000 -0500
> *** 2197,2200 ****
> --- 2315,2319 ----
> cmd->flags |= CMD_IGNORE_RETURN;
> + #if defined (JOB_CONTROL)
> lastpipe_flag = 0;
> begin_unwind_frame ("lastpipe-exec");
> The simple fix of moving the "#if defined (JOBCONTROL)" line below the
> "lastpipe_flag = 0;" may not be the ideal patch.
Maybe not, but it's enough to get started. It just relies on the compiler
doing constant propagation and dead code removal to be as efficient as
using the preprocessor to not compile the code in at all.
I've attached the straightforward patch that does this.
The effect of the bug now is that some process may be waited for twice when
using a system without job control. That's not a big deal.
I'm reluctant to make a more extensive change at this point because this
option makes sense for environments where there isn't job control. In
fact, it makes more sense there because there isn't the process group issue
to have to worry about. The code as it reads today only accommodates job
control systems, but that isn't the way it has to stay.
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
Description: Source code patch