Tomas Janousek 5a0cfd
			     BASH PATCH REPORT
Tomas Janousek 5a0cfd
			     =================
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Bash-Release: 3.2
Tomas Janousek 5a0cfd
Patch-ID: bash32-020
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Bug-Reported-by:	Ian A Watson <WATSON_IAN_A@LILLY.COM>
Tomas Janousek 5a0cfd
Bug-Reference-ID:	<OFEC551808.69D02C7F-ON8525729A.0045708D-8525729A.0046150B@EliLilly.lilly.com>
Tomas Janousek 5a0cfd
Bug-Reference-URL:
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Bug-Description:
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
In some cases of error processing, a jump back to the top-level processing
Tomas Janousek 5a0cfd
loop from a builtin command  would leave the shell in an inconsistent state.
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Patch:
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/sig.c	Wed Jan 25 14:57:59 2006
Tomas Janousek 5a0cfd
--- sig.c	Sat Mar 10 11:11:30 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 351,354 ****
Tomas Janousek 5a0cfd
--- 351,373 ----
Tomas Janousek 5a0cfd
  #undef XHANDLER
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
+ /* Run some of the cleanups that should be performed when we run
Tomas Janousek 5a0cfd
+    jump_to_top_level from a builtin command context.  XXX - might want to
Tomas Janousek 5a0cfd
+    also call reset_parser here. */
Tomas Janousek 5a0cfd
+ void
Tomas Janousek 5a0cfd
+ top_level_cleanup ()
Tomas Janousek 5a0cfd
+ {
Tomas Janousek 5a0cfd
+   /* Clean up string parser environment. */
Tomas Janousek 5a0cfd
+   while (parse_and_execute_level)
Tomas Janousek 5a0cfd
+     parse_and_execute_cleanup ();
Tomas Janousek 5a0cfd
+ 
Tomas Janousek 5a0cfd
+ #if defined (PROCESS_SUBSTITUTION)
Tomas Janousek 5a0cfd
+   unlink_fifo_list ();
Tomas Janousek 5a0cfd
+ #endif /* PROCESS_SUBSTITUTION */
Tomas Janousek 5a0cfd
+ 
Tomas Janousek 5a0cfd
+   run_unwind_protects ();
Tomas Janousek 5a0cfd
+   loop_level = continuing = breaking = 0;
Tomas Janousek 5a0cfd
+   return_catch_flag = 0;
Tomas Janousek 5a0cfd
+ }
Tomas Janousek 5a0cfd
+ 
Tomas Janousek 5a0cfd
  /* What to do when we've been interrupted, and it is safe to handle it. */
Tomas Janousek 5a0cfd
  void
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/sig.h	Wed Jan 25 14:50:27 2006
Tomas Janousek 5a0cfd
--- sig.h	Sat Mar 10 11:14:18 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 122,125 ****
Tomas Janousek 5a0cfd
--- 122,126 ----
Tomas Janousek 5a0cfd
  extern void initialize_terminating_signals __P((void));
Tomas Janousek 5a0cfd
  extern void reset_terminating_signals __P((void));
Tomas Janousek 5a0cfd
+ extern void top_level_cleanup __P((void));
Tomas Janousek 5a0cfd
  extern void throw_to_top_level __P((void));
Tomas Janousek 5a0cfd
  extern void jump_to_top_level __P((int)) __attribute__((__noreturn__));
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/builtins/common.c	Tue Apr  3 16:47:13 2007
Tomas Janousek 5a0cfd
--- builtins/common.c	Mon Apr 30 15:01:33 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 132,135 ****
Tomas Janousek 5a0cfd
--- 132,136 ----
Tomas Janousek 5a0cfd
      {
Tomas Janousek 5a0cfd
        builtin_error (_("too many arguments"));
Tomas Janousek 5a0cfd
+       top_level_cleanup ();
Tomas Janousek 5a0cfd
        jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
      }
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 396,400 ****
Tomas Janousek 5a0cfd
  	    throw_to_top_level ();
Tomas Janousek 5a0cfd
  	  else
Tomas Janousek 5a0cfd
! 	    jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
  	}
Tomas Janousek 5a0cfd
        no_args (list->next);
Tomas Janousek 5a0cfd
--- 410,417 ----
Tomas Janousek 5a0cfd
  	    throw_to_top_level ();
Tomas Janousek 5a0cfd
  	  else
Tomas Janousek 5a0cfd
! 	    {
Tomas Janousek 5a0cfd
! 	      top_level_cleanup ();
Tomas Janousek 5a0cfd
! 	      jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
! 	    }
Tomas Janousek 5a0cfd
  	}
Tomas Janousek 5a0cfd
        no_args (list->next);
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/subst.c	Tue Apr  3 16:47:19 2007
Tomas Janousek 5a0cfd
--- subst.c	Tue Jul 17 09:45:11 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 1279,1283 ****
Tomas Janousek 5a0cfd
        if (no_longjmp_on_fatal_error == 0)
Tomas Janousek 5a0cfd
  	{			/* { */
Tomas Janousek 5a0cfd
! 	  report_error ("bad substitution: no closing `%s' in %s", "}", string);
Tomas Janousek 5a0cfd
  	  last_command_exit_value = EXECUTION_FAILURE;
Tomas Janousek 5a0cfd
  	  exp_jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
--- 1290,1294 ----
Tomas Janousek 5a0cfd
        if (no_longjmp_on_fatal_error == 0)
Tomas Janousek 5a0cfd
  	{			/* { */
Tomas Janousek 5a0cfd
! 	  report_error (_("bad substitution: no closing `%s' in %s"), "}", string);
Tomas Janousek 5a0cfd
  	  last_command_exit_value = EXECUTION_FAILURE;
Tomas Janousek 5a0cfd
  	  exp_jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 7662,7665 ****
Tomas Janousek 5a0cfd
--- 7706,7711 ----
Tomas Janousek 5a0cfd
    expand_no_split_dollar_star = 0;	/* XXX */
Tomas Janousek 5a0cfd
    expanding_redir = 0;
Tomas Janousek 5a0cfd
+ 
Tomas Janousek 5a0cfd
+   top_level_cleanup ();			/* from sig.c */
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
    jump_to_top_level (v);
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 7880,7884 ****
Tomas Janousek 5a0cfd
  	    {
Tomas Janousek 5a0cfd
  	      report_error (_("no match: %s"), tlist->word->word);
Tomas Janousek 5a0cfd
! 	      jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
  	    }
Tomas Janousek 5a0cfd
  	  else if (allow_null_glob_expansion == 0)
Tomas Janousek 5a0cfd
--- 7927,7931 ----
Tomas Janousek 5a0cfd
  	    {
Tomas Janousek 5a0cfd
  	      report_error (_("no match: %s"), tlist->word->word);
Tomas Janousek 5a0cfd
! 	      exp_jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
  	    }
Tomas Janousek 5a0cfd
  	  else if (allow_null_glob_expansion == 0)
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/arrayfunc.c	Thu Jul 27 09:37:59 2006
Tomas Janousek 5a0cfd
--- arrayfunc.c	Thu May 31 11:55:46 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 619,622 ****
Tomas Janousek 5a0cfd
--- 619,624 ----
Tomas Janousek 5a0cfd
      {
Tomas Janousek 5a0cfd
        last_command_exit_value = EXECUTION_FAILURE;
Tomas Janousek 5a0cfd
+ 
Tomas Janousek 5a0cfd
+       top_level_cleanup ();      
Tomas Janousek 5a0cfd
        jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
      }
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/expr.c	Wed Dec 28 17:47:03 2005
Tomas Janousek 5a0cfd
--- expr.c	Tue Apr 24 14:17:59 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 930,933 ****
Tomas Janousek 5a0cfd
--- 930,934 ----
Tomas Janousek 5a0cfd
  	{
Tomas Janousek 5a0cfd
  	  expr_unwind ();
Tomas Janousek 5a0cfd
+ 	  top_level_cleanup ();
Tomas Janousek 5a0cfd
  	  jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
  	}
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/variables.c	Fri Sep  8 13:33:32 2006
Tomas Janousek 5a0cfd
--- variables.c	Tue Jul 17 09:54:59 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 1822,1830 ****
Tomas Janousek 5a0cfd
  	  lval = evalexp (oval, &expok;;	/* ksh93 seems to do this */
Tomas Janousek 5a0cfd
  	  if (expok == 0)
Tomas Janousek 5a0cfd
! 	    jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
  	}
Tomas Janousek 5a0cfd
        rval = evalexp (value, &expok;;
Tomas Janousek 5a0cfd
        if (expok == 0)
Tomas Janousek 5a0cfd
! 	jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
        if (flags & ASS_APPEND)
Tomas Janousek 5a0cfd
  	rval += lval;
Tomas Janousek 5a0cfd
--- 1855,1869 ----
Tomas Janousek 5a0cfd
  	  lval = evalexp (oval, &expok;;	/* ksh93 seems to do this */
Tomas Janousek 5a0cfd
  	  if (expok == 0)
Tomas Janousek 5a0cfd
! 	    {
Tomas Janousek 5a0cfd
! 	      top_level_cleanup ();
Tomas Janousek 5a0cfd
! 	      jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
! 	    }
Tomas Janousek 5a0cfd
  	}
Tomas Janousek 5a0cfd
        rval = evalexp (value, &expok;;
Tomas Janousek 5a0cfd
        if (expok == 0)
Tomas Janousek 5a0cfd
! 	{
Tomas Janousek 5a0cfd
! 	  top_level_cleanup ();
Tomas Janousek 5a0cfd
! 	  jump_to_top_level (DISCARD);
Tomas Janousek 5a0cfd
! 	}
Tomas Janousek 5a0cfd
        if (flags & ASS_APPEND)
Tomas Janousek 5a0cfd
  	rval += lval;
Tomas Janousek 5a0cfd
*** ../bash-3.2/patchlevel.h	Thu Apr 13 08:31:04 2006
Tomas Janousek 5a0cfd
--- patchlevel.h	Mon Oct 16 14:22:54 2006
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 26,30 ****
Tomas Janousek 5a0cfd
     looks for to find the patch level (for the sccs version string). */
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
! #define PATCHLEVEL 19
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
  #endif /* _PATCHLEVEL_H_ */
Tomas Janousek 5a0cfd
--- 26,30 ----
Tomas Janousek 5a0cfd
     looks for to find the patch level (for the sccs version string). */
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
! #define PATCHLEVEL 20
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
  #endif /* _PATCHLEVEL_H_ */