From d6ec391985a4de0deaf0a9ad10acc89d9c7942d8 Mon Sep 17 00:00:00 2001 From: cherry530 Date: Wed, 24 Jun 2020 15:19:40 +0800 Subject: [PATCH] quality enhancement synchronization github patch Signed-off-by: cherry530 --- fix-file-descriptor-leak-with-z.patch | 35 +++++++++++ ...-moving-back-beyond-start-of-history.patch | 52 ++++++++++++++++ ...ng-the-history-file-are-not-signaled.patch | 43 ++++++++++++++ ...entries-with-timestamps-can-result-i.patch | 59 +++++++++++++++++++ readline.spec | 11 +++- 5 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 fix-file-descriptor-leak-with-z.patch create mode 100644 fix-problems-moving-back-beyond-start-of-history.patch create mode 100644 problems-restoring-the-history-file-are-not-signaled.patch create mode 100644 reading-history-entries-with-timestamps-can-result-i.patch diff --git a/fix-file-descriptor-leak-with-z.patch b/fix-file-descriptor-leak-with-z.patch new file mode 100644 index 0000000..dc0622e --- /dev/null +++ b/fix-file-descriptor-leak-with-z.patch @@ -0,0 +1,35 @@ +From f585708e822e021e15e5bece1de482b63ba581df Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Wed, 14 Aug 2019 11:28:48 -0400 +Subject: [PATCH 1/4] Readline-8.0 patch 1: fix file descriptor leak with + zero-length history file + +--- + histfile.c | 1 + + patchlevel | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/histfile.c b/histfile.c +index dc64bde..a8a92aa 100644 +--- a/histfile.c ++++ b/histfile.c +@@ -305,6 +305,7 @@ read_history_range (const char *filename, int from, int to) + if (file_size == 0) + { + free (input); ++ close (file); + return 0; /* don't waste time if we don't have to */ + } + +diff --git a/patchlevel b/patchlevel +index d8c9df7..fdf4740 100644 +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-0 ++1 +-- +1.8.3.1 + diff --git a/fix-problems-moving-back-beyond-start-of-history.patch b/fix-problems-moving-back-beyond-start-of-history.patch new file mode 100644 index 0000000..f820309 --- /dev/null +++ b/fix-problems-moving-back-beyond-start-of-history.patch @@ -0,0 +1,52 @@ +From d063aa6a54e670adeaa9b71385394dbf8dc9ff63 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 14:56:45 -0500 +Subject: [PATCH 2/4] fix problems moving back beyond start of history + +--- + misc.c | 5 ++++- + patchlevel | 2 +- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/misc.c b/misc.c +index 64b1457..42005b0 100644 +--- a/misc.c ++++ b/misc.c +@@ -576,6 +576,7 @@ int + rl_get_previous_history (int count, int key) + { + HIST_ENTRY *old_temp, *temp; ++ int had_saved_line; + + if (count < 0) + return (rl_get_next_history (-count, key)); +@@ -588,6 +589,7 @@ rl_get_previous_history (int count, int key) + _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point; + + /* If we don't have a line saved, then save this one. */ ++ had_saved_line = _rl_saved_line_for_history != 0; + rl_maybe_save_line (); + + /* If the current line has changed, save the changes. */ +@@ -611,7 +613,8 @@ rl_get_previous_history (int count, int key) + + if (temp == 0) + { +- rl_maybe_unsave_line (); ++ if (had_saved_line == 0) ++ _rl_free_saved_history_line (); + rl_ding (); + } + else +diff --git a/patchlevel b/patchlevel +index fdf4740..7cbda82 100644 +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-1 ++2 +-- +1.8.3.1 + diff --git a/problems-restoring-the-history-file-are-not-signaled.patch b/problems-restoring-the-history-file-are-not-signaled.patch new file mode 100644 index 0000000..51766b1 --- /dev/null +++ b/problems-restoring-the-history-file-are-not-signaled.patch @@ -0,0 +1,43 @@ +From c5ad6be530f5c1daf64a2d20df4baba9f6b57aa4 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 14:58:55 -0500 +Subject: [PATCH 4/4] 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 +-- +1.8.3.1 + diff --git a/reading-history-entries-with-timestamps-can-result-i.patch b/reading-history-entries-with-timestamps-can-result-i.patch new file mode 100644 index 0000000..9e69e37 --- /dev/null +++ b/reading-history-entries-with-timestamps-can-result-i.patch @@ -0,0 +1,59 @@ +From f5720c8cabbdb2387b4dc9e36633a73df6a634da Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 14:57:47 -0500 +Subject: [PATCH 3/4] reading history entries with timestamps can result in + joined entries + +--- + histfile.c | 15 ++++++++++++++- + patchlevel | 2 +- + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/histfile.c b/histfile.c +index a8a92aa..6c3adc9 100644 +--- a/histfile.c ++++ b/histfile.c +@@ -369,9 +369,11 @@ read_history_range (const char *filename, int from, int to) + } + + has_timestamps = HIST_TIMESTAMP_START (buffer); +- history_multiline_entries += has_timestamps && history_write_timestamps; ++ history_multiline_entries += has_timestamps && history_write_timestamps; + + /* Skip lines until we are at FROM. */ ++ if (has_timestamps) ++ last_ts = buffer; + for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++) + if (*line_end == '\n') + { +@@ -380,7 +382,18 @@ read_history_range (const char *filename, int from, int to) + line. We should check more extensively here... */ + if (HIST_TIMESTAMP_START(p) == 0) + current_line++; ++ else ++ last_ts = p; + line_start = p; ++ /* If we are at the last line (current_line == from) but we have ++ timestamps (has_timestamps), then line_start points to the ++ text of the last command, and we need to skip to its end. */ ++ if (current_line >= from && has_timestamps) ++ { ++ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++) ++ ; ++ line_start = (*line_end == '\n') ? line_end + 1 : line_end; ++ } + } + + /* If there are lines left to gobble, then gobble them now. */ +diff --git a/patchlevel b/patchlevel +index 7cbda82..ce3e355 100644 +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-2 ++3 +-- +1.8.3.1 + diff --git a/readline.spec b/readline.spec index 897d0dc..4df88c6 100644 --- a/readline.spec +++ b/readline.spec @@ -1,13 +1,17 @@ Name: readline Version: 8.0 -Release: 1 +Release: 2 Summary: Readline library for editing typed command lines License: GPLv3+ URL: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html Source0: http://git.savannah.gnu.org/cgit/readline.git/snapshot/%{name}-%{version}.tar.gz -Patch1: readline-8.0-shlib.patch +Patch0000: readline-8.0-shlib.patch +Patch0001: fix-file-descriptor-leak-with-z.patch +Patch0002: fix-problems-moving-back-beyond-start-of-history.patch +Patch0003: reading-history-entries-with-timestamps-can-result-i.patch +Patch6004: problems-restoring-the-history-file-are-not-signaled.patch BuildRequires: gcc gcc-c++ ncurses-devel readline @@ -80,6 +84,9 @@ cp -a %{_libdir}/lib{readline,history}.so.7* %{buildroot}%{_libdir} %changelog +* Wed Jun 24 2020 xuping - 8.0-2 +- quality enhancement synchronization github patch + * Fri Apr 24 2020 openEuler Buildteam - 8.0 - update to 8.0 -- Gitee