bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in patch bash42-018, leaves lastpipe_flag unitialized for platforms


From: John E. Malmberg
Subject: Bug in patch bash42-018, leaves lastpipe_flag unitialized for platforms with out JOB_CONTROL.
Date: Thu, 21 Jun 2012 07:42:08 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0

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.

This is because JOB_CONTROL undefined, the entire if block lower below "QUIT;" is never executed, as lastpipe_flag is always 0.

Which means that it is kind of useless to have #if defined(JOB_CONTROL) blocks inside of it. If this is the intended logic flow, then the entire "if (lastpipe_flag)" block should be conditionally compiled out.

Doing that and leaving the definition of the lastpipe_flag undefined as in the original patch will still result in a compiler diagnostic about an unused variable.

So that would need an #if defined (JOBCONTROL) needed around the declaration.

So what should be the correct patch?  Is there another bug hiding in this?

Regards,
-John
wb8tyw@qsl.network
Personal Opinion Only




reply via email to

[Prev in Thread] Current Thread [Next in Thread]