1 BASH PATCH REPORT |
|
2 ================= |
|
3 |
|
4 Bash-Release: 4.2 |
|
5 Patch-ID: bash42-035 |
|
6 |
|
7 Bug-Reported-by: Dan Douglas <[email protected]> |
|
8 Bug-Reference-ID: <2766482.Ksm3GrSoYi@smorgbox> |
|
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2012-06/msg00071.html |
|
10 |
|
11 Bug-Description: |
|
12 |
|
13 When given a number of lines to read, `mapfile -n lines' reads one too many. |
|
14 |
|
15 Patch (apply with `patch -p0'): |
|
16 |
|
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 |
|
19 *************** |
|
20 *** 196,206 **** |
|
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++) |
|
25 { |
|
26 - /* Have we exceeded # of lines to store? */ |
|
27 - if (line_count_goal != 0 && line_count > line_count_goal) |
|
28 - break; |
|
29 - |
|
30 /* Remove trailing newlines? */ |
|
31 if (flags & MAPF_CHOP) |
|
32 --- 196,202 ---- |
|
33 interrupt_immediately++; |
|
34 for (array_index = origin, line_count = 1; |
|
35 ! zgetline (fd, &line, &line_length, unbuffered_read) != -1; |
|
36 ! array_index++) |
|
37 { |
|
38 /* Remove trailing newlines? */ |
|
39 if (flags & MAPF_CHOP) |
|
40 *************** |
|
41 *** 218,221 **** |
|
42 --- 214,222 ---- |
|
43 |
|
44 bind_array_element (entry, array_index, line, 0); |
|
45 + |
|
46 + /* Have we exceeded # of lines to store? */ |
|
47 + line_count++; |
|
48 + if (line_count_goal != 0 && line_count > line_count_goal) |
|
49 + break; |
|
50 } |
|
51 |
|
52 *** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010 |
|
53 --- patchlevel.h Thu Feb 24 21:41:34 2011 |
|
54 *************** |
|
55 *** 26,30 **** |
|
56 looks for to find the patch level (for the sccs version string). */ |
|
57 |
|
58 ! #define PATCHLEVEL 34 |
|
59 |
|
60 #endif /* _PATCHLEVEL_H_ */ |
|
61 --- 26,30 ---- |
|
62 looks for to find the patch level (for the sccs version string). */ |
|
63 |
|
64 ! #define PATCHLEVEL 35 |
|
65 |
|
66 #endif /* _PATCHLEVEL_H_ */ |
|