0013-bash50-013.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. From https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-013
  2. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. BASH PATCH REPORT
  4. =================
  5. Bash-Release: 5.0
  6. Patch-ID: bash50-013
  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. Bug-Description:
  11. Reading history entries with timestamps can result in history entries joined
  12. by linefeeds.
  13. Patch (apply with `patch -p0'):
  14. *** ../bash-5.0-patched/lib/readline/histfile.c 2018-06-11 09:14:52.000000000 -0400
  15. --- b/lib/readline/histfile.c 2019-05-16 15:55:57.000000000 -0400
  16. ***************
  17. *** 370,376 ****
  18. has_timestamps = HIST_TIMESTAMP_START (buffer);
  19. ! history_multiline_entries += has_timestamps && history_write_timestamps;
  20. /* Skip lines until we are at FROM. */
  21. for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
  22. if (*line_end == '\n')
  23. --- 370,378 ----
  24. has_timestamps = HIST_TIMESTAMP_START (buffer);
  25. ! history_multiline_entries += has_timestamps && history_write_timestamps;
  26. /* Skip lines until we are at FROM. */
  27. + if (has_timestamps)
  28. + last_ts = buffer;
  29. for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
  30. if (*line_end == '\n')
  31. ***************
  32. *** 381,385 ****
  33. --- 383,398 ----
  34. if (HIST_TIMESTAMP_START(p) == 0)
  35. current_line++;
  36. + else
  37. + last_ts = p;
  38. line_start = p;
  39. + /* If we are at the last line (current_line == from) but we have
  40. + timestamps (has_timestamps), then line_start points to the
  41. + text of the last command, and we need to skip to its end. */
  42. + if (current_line >= from && has_timestamps)
  43. + {
  44. + for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
  45. + ;
  46. + line_start = (*line_end == '\n') ? line_end + 1 : line_end;
  47. + }
  48. }
  49. *** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
  50. --- b/patchlevel.h 2016-10-01 11:01:28.000000000 -0400
  51. ***************
  52. *** 26,30 ****
  53. looks for to find the patch level (for the sccs version string). */
  54. ! #define PATCHLEVEL 12
  55. #endif /* _PATCHLEVEL_H_ */
  56. --- 26,30 ----
  57. looks for to find the patch level (for the sccs version string). */
  58. ! #define PATCHLEVEL 13
  59. #endif /* _PATCHLEVEL_H_ */