]>
Commit | Line | Data |
---|---|---|
987826de PM |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 5.0 | |
5 | Patch-ID: bash50-013 | |
6 | ||
7 | Bug-Reported-by: HIROSE Masaaki <hirose31@gmail.com> | |
8 | Bug-Reference-ID: <CAGSOfA-RqiTe=+GsXsDKyZrrMWH4bDbXgMVVegMa6OjqC5xbnQ@mail.gmail.com> | |
9 | Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-05/msg00038.html | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | Reading history entries with timestamps can result in history entries joined | |
14 | by linefeeds. | |
15 | ||
16 | Patch (apply with `patch -p0'): | |
17 | ||
18 | *** ../bash-5.0-patched/lib/readline/histfile.c 2018-06-11 09:14:52.000000000 -0400 | |
19 | --- lib/readline/histfile.c 2019-05-16 15:55:57.000000000 -0400 | |
20 | *************** | |
21 | *** 370,376 **** | |
22 | ||
23 | has_timestamps = HIST_TIMESTAMP_START (buffer); | |
24 | ! history_multiline_entries += has_timestamps && history_write_timestamps; | |
25 | ||
26 | /* Skip lines until we are at FROM. */ | |
27 | for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++) | |
28 | if (*line_end == '\n') | |
29 | --- 370,378 ---- | |
30 | ||
31 | has_timestamps = HIST_TIMESTAMP_START (buffer); | |
32 | ! history_multiline_entries += has_timestamps && history_write_timestamps; | |
33 | ||
34 | /* Skip lines until we are at FROM. */ | |
35 | + if (has_timestamps) | |
36 | + last_ts = buffer; | |
37 | for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++) | |
38 | if (*line_end == '\n') | |
39 | *************** | |
40 | *** 381,385 **** | |
41 | --- 383,398 ---- | |
42 | if (HIST_TIMESTAMP_START(p) == 0) | |
43 | current_line++; | |
44 | + else | |
45 | + last_ts = p; | |
46 | line_start = p; | |
47 | + /* If we are at the last line (current_line == from) but we have | |
48 | + timestamps (has_timestamps), then line_start points to the | |
49 | + text of the last command, and we need to skip to its end. */ | |
50 | + if (current_line >= from && has_timestamps) | |
51 | + { | |
52 | + for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++) | |
53 | + ; | |
54 | + line_start = (*line_end == '\n') ? line_end + 1 : line_end; | |
55 | + } | |
56 | } | |
57 | ||
58 | ||
59 | *** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400 | |
60 | --- patchlevel.h 2016-10-01 11:01:28.000000000 -0400 | |
61 | *************** | |
62 | *** 26,30 **** | |
63 | looks for to find the patch level (for the sccs version string). */ | |
64 | ||
65 | ! #define PATCHLEVEL 12 | |
66 | ||
67 | #endif /* _PATCHLEVEL_H_ */ | |
68 | --- 26,30 ---- | |
69 | looks for to find the patch level (for the sccs version string). */ | |
70 | ||
71 | ! #define PATCHLEVEL 13 | |
72 | ||
73 | #endif /* _PATCHLEVEL_H_ */ |