7 Bug-Reported-by: Dan Douglas <ormaaj@gmail.com>
8 Bug-Reference-ID: <2766482.Ksm3GrSoYi@smorgbox>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2012-06/msg00071.html
13 When given a number of lines to read, `mapfile -n lines' reads one too many.
15 Patch (apply with `patch -p0'):
17 *** ../bash-4.2-patched/builtins/mapfile.def 2010-05-29 22:09:47.000000000 -0400
18 --- builtins/mapfile.def 2012-06-20 09:48:33.000000000 -0400
21 interrupt_immediately++;
22 for (array_index = origin, line_count = 1;
23 ! zgetline (fd, &line, &line_length, unbuffered_read) != -1;
24 ! array_index++, line_count++)
26 - /* Have we exceeded # of lines to store? */
27 - if (line_count_goal != 0 && line_count > line_count_goal)
30 /* Remove trailing newlines? */
31 if (flags & MAPF_CHOP)
33 interrupt_immediately++;
34 for (array_index = origin, line_count = 1;
35 ! zgetline (fd, &line, &line_length, unbuffered_read) != -1;
38 /* Remove trailing newlines? */
39 if (flags & MAPF_CHOP)
44 bind_array_element (entry, array_index, line, 0);
46 + /* Have we exceeded # of lines to store? */
48 + if (line_count_goal != 0 && line_count > line_count_goal)
52 *** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010
53 --- patchlevel.h Thu Feb 24 21:41:34 2011
56 looks for to find the patch level (for the sccs version string). */
58 ! #define PATCHLEVEL 34
60 #endif /* _PATCHLEVEL_H_ */
62 looks for to find the patch level (for the sccs version string). */
64 ! #define PATCHLEVEL 35
66 #endif /* _PATCHLEVEL_H_ */