Blame SOURCES/bash42-015

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