nalika / rpms / bash

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