462fb2
			     BASH PATCH REPORT
462fb2
			     =================
462fb2
462fb2
Bash-Release:	4.2
462fb2
Patch-ID:	bash42-015
462fb2
462fb2
Bug-Reported-by:	<dnade.ext@orange-ftgroup.com>
462fb2
Bug-Reference-ID:	<728_1312188080_4E3666B0_728_118711_1_3B5D3E0F95CC5C478D6500CDCE8B691F7AAAA4AA3D@PUEXCB2B.nanterre.francetelecom.fr>
462fb2
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-08/msg00000.html
462fb2
462fb2
Bug-Description:
462fb2
462fb2
When in a context where arithmetic evaluation is not taking place, the
462fb2
evaluator should not check for division by 0.
462fb2
462fb2
Patch (apply with `patch -p0'):
462fb2
462fb2
*** ../bash-4.2-patched/expr.c	2010-12-21 11:12:13.000000000 -0500
462fb2
--- expr.c	2011-08-02 20:58:28.000000000 -0400
462fb2
***************
462fb2
*** 477,480 ****
462fb2
--- 481,492 ----
462fb2
        if (special)
462fb2
  	{
462fb2
+ 	  if ((op == DIV || op == MOD) && value == 0)
462fb2
+ 	    {
462fb2
+ 	      if (noeval == 0)
462fb2
+ 		evalerror (_("division by 0"));
462fb2
+ 	      else
462fb2
+ 	        value = 1;
462fb2
+ 	    }
462fb2
+ 
462fb2
  	  switch (op)
462fb2
  	    {
462fb2
***************
462fb2
*** 483,493 ****
462fb2
  	      break;
462fb2
  	    case DIV:
462fb2
- 	      if (value == 0)
462fb2
- 		evalerror (_("division by 0"));
462fb2
  	      lvalue /= value;
462fb2
  	      break;
462fb2
  	    case MOD:
462fb2
- 	      if (value == 0)
462fb2
- 		evalerror (_("division by 0"));
462fb2
  	      lvalue %= value;
462fb2
  	      break;
462fb2
--- 495,501 ----
462fb2
***************
462fb2
*** 805,809 ****
462fb2
  
462fb2
        if (((op == DIV) || (op == MOD)) && (val2 == 0))
462fb2
! 	evalerror (_("division by 0"));
462fb2
  
462fb2
        if (op == MUL)
462fb2
--- 813,822 ----
462fb2
  
462fb2
        if (((op == DIV) || (op == MOD)) && (val2 == 0))
462fb2
! 	{
462fb2
! 	  if (noeval == 0)
462fb2
! 	    evalerror (_("division by 0"));
462fb2
! 	  else
462fb2
! 	    val2 = 1;
462fb2
! 	}
462fb2
  
462fb2
        if (op == MUL)
462fb2
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
462fb2
--- patchlevel.h	Thu Feb 24 21:41:34 2011
462fb2
***************
462fb2
*** 26,30 ****
462fb2
     looks for to find the patch level (for the sccs version string). */
462fb2
  
462fb2
! #define PATCHLEVEL 14
462fb2
  
462fb2
  #endif /* _PATCHLEVEL_H_ */
462fb2
--- 26,30 ----
462fb2
     looks for to find the patch level (for the sccs version string). */
462fb2
  
462fb2
! #define PATCHLEVEL 15
462fb2
  
462fb2
  #endif /* _PATCHLEVEL_H_ */