Blame SOURCES/bash42-009

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