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