Roman Rakus 159e5e
			     BASH PATCH REPORT
Roman Rakus 159e5e
			     =================
Roman Rakus 159e5e
Roman Rakus 159e5e
Bash-Release:	4.2
Roman Rakus 159e5e
Patch-ID:	bash42-035
Roman Rakus 159e5e
Roman Rakus 159e5e
Bug-Reported-by:	Dan Douglas <ormaaj@gmail.com>
Roman Rakus 159e5e
Bug-Reference-ID:	<2766482.Ksm3GrSoYi@smorgbox>
Roman Rakus 159e5e
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-06/msg00071.html
Roman Rakus 159e5e
Roman Rakus 159e5e
Bug-Description:
Roman Rakus 159e5e
Roman Rakus 159e5e
When given a number of lines to read, `mapfile -n lines' reads one too many.
Roman Rakus 159e5e
Roman Rakus 159e5e
Patch (apply with `patch -p0'):
Roman Rakus 159e5e
Roman Rakus 159e5e
*** ../bash-4.2-patched/builtins/mapfile.def	2010-05-29 22:09:47.000000000 -0400
Roman Rakus 159e5e
--- builtins/mapfile.def	2012-06-20 09:48:33.000000000 -0400
Roman Rakus 159e5e
***************
Roman Rakus 159e5e
*** 196,206 ****
Roman Rakus 159e5e
    interrupt_immediately++;
Roman Rakus 159e5e
    for (array_index = origin, line_count = 1; 
Roman Rakus 159e5e
!        zgetline (fd, &line, &line_length, unbuffered_read) != -1;
Roman Rakus 159e5e
!        array_index++, line_count++) 
Roman Rakus 159e5e
      {
Roman Rakus 159e5e
-       /* Have we exceeded # of lines to store? */
Roman Rakus 159e5e
-       if (line_count_goal != 0 && line_count > line_count_goal) 
Roman Rakus 159e5e
- 	break;
Roman Rakus 159e5e
- 
Roman Rakus 159e5e
        /* Remove trailing newlines? */
Roman Rakus 159e5e
        if (flags & MAPF_CHOP)
Roman Rakus 159e5e
--- 196,202 ----
Roman Rakus 159e5e
    interrupt_immediately++;
Roman Rakus 159e5e
    for (array_index = origin, line_count = 1; 
Roman Rakus 159e5e
!  	zgetline (fd, &line, &line_length, unbuffered_read) != -1;
Roman Rakus 159e5e
! 	array_index++) 
Roman Rakus 159e5e
      {
Roman Rakus 159e5e
        /* Remove trailing newlines? */
Roman Rakus 159e5e
        if (flags & MAPF_CHOP)
Roman Rakus 159e5e
***************
Roman Rakus 159e5e
*** 218,221 ****
Roman Rakus 159e5e
--- 214,222 ----
Roman Rakus 159e5e
  
Roman Rakus 159e5e
        bind_array_element (entry, array_index, line, 0);
Roman Rakus 159e5e
+ 
Roman Rakus 159e5e
+       /* Have we exceeded # of lines to store? */
Roman Rakus 159e5e
+       line_count++;
Roman Rakus 159e5e
+       if (line_count_goal != 0 && line_count > line_count_goal) 
Roman Rakus 159e5e
+ 	break;
Roman Rakus 159e5e
      }
Roman Rakus 159e5e
  
Roman Rakus 159e5e
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
Roman Rakus 159e5e
--- patchlevel.h	Thu Feb 24 21:41:34 2011
Roman Rakus 159e5e
***************
Roman Rakus 159e5e
*** 26,30 ****
Roman Rakus 159e5e
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 159e5e
  
Roman Rakus 159e5e
! #define PATCHLEVEL 34
Roman Rakus 159e5e
  
Roman Rakus 159e5e
  #endif /* _PATCHLEVEL_H_ */
Roman Rakus 159e5e
--- 26,30 ----
Roman Rakus 159e5e
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 159e5e
  
Roman Rakus 159e5e
! #define PATCHLEVEL 35
Roman Rakus 159e5e
  
Roman Rakus 159e5e
  #endif /* _PATCHLEVEL_H_ */