From a93b5b31968bd07385a6cf2a8a1d0bdf1df9720e Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Fri, 7 Feb 2020 14:58:55 -0500 Subject: [PATCH 1/2] problems restoring the history file are not signaled correctly to the calling application --- histfile.c | 2 ++ patchlevel | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/histfile.c b/histfile.c index 6c3adc9..8eb3496 100644 --- a/histfile.c +++ b/histfile.c @@ -620,6 +620,7 @@ history_truncate_file (const char *fname, int lines) if (rv != 0) { + rv = errno; if (tempname) unlink (tempname); history_lines_written_to_file = 0; @@ -767,6 +768,7 @@ mmap_error: if (rv != 0) { + rv = errno; if (tempname) unlink (tempname); history_lines_written_to_file = 0; diff --git a/patchlevel b/patchlevel index ce3e355..626a945 100644 --- a/patchlevel +++ b/patchlevel @@ -1,3 +1,3 @@ # Do not edit -- exists only for use by patch -3 +4 -- 2.17.1 From de1e4bcf64c0ff4b6c26da8bb569e2378bef090a Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Tue, 8 Sep 2020 11:26:26 +1200 Subject: [PATCH 2/2] Fix segfault in rl_update_final If rl_display gets overridden i.e. for password entry init_line_structures is not called. See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941326 Signed-off-by: Gary Lockyer --- display.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/display.c b/display.c index 4c6cc00..78e7a45 100644 --- a/display.c +++ b/display.c @@ -2959,6 +2959,15 @@ _rl_update_final (void) int full_lines, woff, botline_length; full_lines = 0; + + /* If line_structures_initialized has not been called + * there is nothing to do. This can happen if rl_redisplay is overridden + * for password entry or similar purposes. + */ + if (line_structures_initialized == 0) { + return; + } + /* If the cursor is the only thing on an otherwise-blank last line, compensate so we don't print an extra CRLF. */ if (_rl_vis_botlin && _rl_last_c_pos == 0 && -- 2.17.1