07a490
			     BASH PATCH REPORT
07a490
			     =================
07a490
07a490
Bash-Release:	4.2
07a490
Patch-ID:	bash42-035
07a490
07a490
Bug-Reported-by:	Dan Douglas <ormaaj@gmail.com>
07a490
Bug-Reference-ID:	<2766482.Ksm3GrSoYi@smorgbox>
07a490
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-06/msg00071.html
07a490
07a490
Bug-Description:
07a490
07a490
When given a number of lines to read, `mapfile -n lines' reads one too many.
07a490
07a490
Patch (apply with `patch -p0'):
07a490
07a490
*** ../bash-4.2-patched/builtins/mapfile.def	2010-05-29 22:09:47.000000000 -0400
07a490
--- builtins/mapfile.def	2012-06-20 09:48:33.000000000 -0400
07a490
***************
07a490
*** 196,206 ****
07a490
    interrupt_immediately++;
07a490
    for (array_index = origin, line_count = 1; 
07a490
!        zgetline (fd, &line, &line_length, unbuffered_read) != -1;
07a490
!        array_index++, line_count++) 
07a490
      {
07a490
-       /* Have we exceeded # of lines to store? */
07a490
-       if (line_count_goal != 0 && line_count > line_count_goal) 
07a490
- 	break;
07a490
- 
07a490
        /* Remove trailing newlines? */
07a490
        if (flags & MAPF_CHOP)
07a490
--- 196,202 ----
07a490
    interrupt_immediately++;
07a490
    for (array_index = origin, line_count = 1; 
07a490
!  	zgetline (fd, &line, &line_length, unbuffered_read) != -1;
07a490
! 	array_index++) 
07a490
      {
07a490
        /* Remove trailing newlines? */
07a490
        if (flags & MAPF_CHOP)
07a490
***************
07a490
*** 218,221 ****
07a490
--- 214,222 ----
07a490
  
07a490
        bind_array_element (entry, array_index, line, 0);
07a490
+ 
07a490
+       /* Have we exceeded # of lines to store? */
07a490
+       line_count++;
07a490
+       if (line_count_goal != 0 && line_count > line_count_goal) 
07a490
+ 	break;
07a490
      }
07a490
  
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 34
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 35
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */