287226
			     BASH PATCH REPORT
287226
			     =================
287226
287226
Bash-Release:	4.2
287226
Patch-ID:	bash42-009
287226
287226
Bug-Reported-by:	<piuma@piumalab.org>
287226
Bug-Reference-ID:	<4DAAC0DB.7060606@piumalab.org>
287226
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00075.html
287226
287226
Bug-Description:
287226
287226
Under certain circumstances, running `fc -l' two times in succession with a
287226
relative history offset at the end of the history will result in an incorrect
287226
calculation of the last history entry and a seg fault.
287226
287226
Patch (apply with `patch -p0'):
287226
287226
*** ../bash-4.2-patched/builtins/fc.def	2010-05-30 18:25:38.000000000 -0400
287226
--- builtins/fc.def	2011-04-19 15:46:17.000000000 -0400
287226
***************
287226
*** 305,309 ****
287226
  
287226
    /* XXX */
287226
!   if (saved_command_line_count > 0 && i == last_hist && hlist[last_hist] == 0)
287226
      while (last_hist >= 0 && hlist[last_hist] == 0)
287226
        last_hist--;
287226
--- 305,309 ----
287226
  
287226
    /* XXX */
287226
!   if (i == last_hist && hlist[last_hist] == 0)
287226
      while (last_hist >= 0 && hlist[last_hist] == 0)
287226
        last_hist--;
287226
***************
287226
*** 476,480 ****
287226
  {
287226
    int sign, n, clen, rh;
287226
!   register int i, j;
287226
    register char *s;
287226
  
287226
--- 476,480 ----
287226
  {
287226
    int sign, n, clen, rh;
287226
!   register int i, j, last_hist;
287226
    register char *s;
287226
  
287226
***************
287226
*** 496,500 ****
287226
       calculation as if it were on. */
287226
    rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
287226
!   i -= rh + hist_last_line_added;
287226
  
287226
    /* No specification defaults to most recent command. */
287226
--- 496,508 ----
287226
       calculation as if it were on. */
287226
    rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
287226
!   last_hist = i - rh - hist_last_line_added;
287226
! 
287226
!   if (i == last_hist && hlist[last_hist] == 0)
287226
!     while (last_hist >= 0 && hlist[last_hist] == 0)
287226
!       last_hist--;
287226
!   if (last_hist < 0)
287226
!     return (-1);
287226
! 
287226
!   i = last_hist;
287226
  
287226
    /* No specification defaults to most recent command. */
287226
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
287226
--- patchlevel.h	Thu Feb 24 21:41:34 2011
287226
***************
287226
*** 26,30 ****
287226
     looks for to find the patch level (for the sccs version string). */
287226
  
287226
! #define PATCHLEVEL 8
287226
  
287226
  #endif /* _PATCHLEVEL_H_ */
287226
--- 26,30 ----
287226
     looks for to find the patch level (for the sccs version string). */
287226
  
287226
! #define PATCHLEVEL 9
287226
  
287226
  #endif /* _PATCHLEVEL_H_ */