!8 update readline to 8.0

Merge pull request !8 from wangchen/master
This commit is contained in:
openeuler-ci-bot 2020-07-14 11:00:09 +08:00 committed by Gitee
commit 0f746f6e61
13 changed files with 203 additions and 262 deletions

View File

@ -1,46 +0,0 @@
From acf3951d483e7b3478db4d731f4a8af99d27327d Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 16 Nov 2016 12:57:31 -0500
Subject: [PATCH] Readline-7.0 patch 1
---
history.c | 6 +++++-
patchlevel | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/history.c b/history.c
index 3b8dbc5..9ff25a7 100644
--- a/history.c
+++ b/history.c
@@ -57,6 +57,8 @@ extern int errno;
/* How big to make the_history when we first allocate it. */
#define DEFAULT_HISTORY_INITIAL_SIZE 502
+#define MAX_HISTORY_INITIAL_SIZE 8192
+
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
@@ -307,7 +309,9 @@ add_history (string)
if (history_size == 0)
{
if (history_stifled && history_max_entries > 0)
- history_size = history_max_entries + 2;
+ history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
+ ? MAX_HISTORY_INITIAL_SIZE
+ : history_max_entries + 2;
else
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
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
--
2.9.3

View File

@ -1,77 +0,0 @@
From e3f5a97bfa54db0d4e4fe67e406e64f1a58508ea Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Sun, 29 Jan 2017 13:55:34 -0500
Subject: [PATCH] Readline-7.0 patch 2
---
history.c | 16 +++++++---------
patchlevel | 2 +-
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/history.c b/history.c
index 9ff25a7..129c57a 100644
--- a/history.c
+++ b/history.c
@@ -279,6 +279,7 @@ add_history (string)
const char *string;
{
HIST_ENTRY *temp;
+ int new_length;
if (history_stifled && (history_length == history_max_entries))
{
@@ -295,13 +296,9 @@ add_history (string)
/* Copy the rest of the entries, moving down one slot. Copy includes
trailing NULL. */
-#if 0
- for (i = 0; i < history_length; i++)
- the_history[i] = the_history[i + 1];
-#else
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
-#endif
+ new_length = history_length;
history_base++;
}
else
@@ -315,7 +312,7 @@ add_history (string)
else
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
- history_length = 1;
+ new_length = 1;
}
else
{
@@ -325,14 +322,15 @@ add_history (string)
the_history = (HIST_ENTRY **)
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
}
- history_length++;
+ new_length = history_length + 1;
}
}
temp = alloc_history_entry ((char *)string, hist_inittime ());
- the_history[history_length] = (HIST_ENTRY *)NULL;
- the_history[history_length - 1] = temp;
+ the_history[new_length] = (HIST_ENTRY *)NULL;
+ the_history[new_length - 1] = temp;
+ history_length = new_length;
}
/* Change the time stamp of the most recent history entry to STRING. */
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
--
2.13.6

View File

@ -1,34 +0,0 @@
From 6c32f81cd66bbe86218469063690c84205661a5e Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Sun, 29 Jan 2017 13:55:51 -0500
Subject: [PATCH] Readline-7.0 patch 3
---
input.c | 1 +
patchlevel | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/input.c b/input.c
index 286897d..24126ea 100644
--- a/input.c
+++ b/input.c
@@ -513,6 +513,7 @@ rl_getc (stream)
result = 0;
#if defined (HAVE_PSELECT)
sigemptyset (&empty_set);
+ sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &empty_set);
FD_ZERO (&readfds);
FD_SET (fileno (stream), &readfds);
result = pselect (fileno (stream) + 1, &readfds, NULL, NULL, NULL, &empty_set);
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
--
2.13.6

View File

@ -1,37 +0,0 @@
From 457e4fbeb977ffe065dc2ba05a0ebc4000b32065 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 1 Jun 2018 10:17:06 -0400
Subject: [PATCH] readline-7.0 patch 4
---
display.c | 4 +++-
patchlevel | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/display.c b/display.c
index 41fb053..2d2e768 100644
--- a/display.c
+++ b/display.c
@@ -771,7 +771,9 @@ rl_redisplay ()
appear in the first and last lines of the prompt */
wadjust = (newlines == 0)
? prompt_invis_chars_first_line
- : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);
+ : ((newlines == prompt_lines_estimate)
+ ? (wrap_offset - prompt_invis_chars_first_line)
+ : 0);
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
invisible characters that is longer than the screen width. The
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.14.4

View File

@ -1,44 +0,0 @@
From 57ea39840aebbb34571df1586acc66783b3368d0 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 1 Jun 2018 10:17:53 -0400
Subject: [PATCH] readline-7.0 patch 5
---
patchlevel | 2 +-
readline.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/patchlevel b/patchlevel
index 626a945..e0ba09d 100644
--- a/patchlevel
+++ b/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-4
+5
diff --git a/readline.c b/readline.c
index e51df4f..a05b35e 100644
--- a/readline.c
+++ b/readline.c
@@ -1057,7 +1057,7 @@ _rl_subseq_result (r, map, key, got_subseq)
/* We probably shadowed a keymap, so keep going. */
r = _rl_dispatch (ANYOTHERKEY, m);
}
- else if (r && map[ANYOTHERKEY].function)
+ else if (r < 0 && map[ANYOTHERKEY].function)
{
/* We didn't match (r is probably -1), so return something to
tell the caller that it should try ANYOTHERKEY for an
@@ -1069,7 +1069,7 @@ _rl_subseq_result (r, map, key, got_subseq)
_rl_dispatching_keymap = map;
return -2;
}
- else if (r && got_subseq)
+ else if (r < 0 && got_subseq) /* XXX */
{
/* OK, back up the chain. */
if (RL_ISSTATE (RL_STATE_MACROINPUT))
--
2.14.4

View File

@ -0,0 +1,35 @@
From f585708e822e021e15e5bece1de482b63ba581df Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

View File

@ -0,0 +1,52 @@
From d063aa6a54e670adeaa9b71385394dbf8dc9ff63 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

View File

@ -0,0 +1,43 @@
From c5ad6be530f5c1daf64a2d20df4baba9f6b57aa4 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

View File

@ -0,0 +1,59 @@
From f5720c8cabbdb2387b4dc9e36633a73df6a634da Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

Binary file not shown.

View File

@ -5,7 +5,6 @@ Subject: [PATCH] shlib
--- ---
shlib/Makefile.in | 2 +- shlib/Makefile.in | 2 +-
support/shlib-install | 2 +-
support/shobj-conf | 5 +++-- support/shobj-conf | 5 +++--
3 files changed, 5 insertions(+), 4 deletions(-) 3 files changed, 5 insertions(+), 4 deletions(-)
@ -22,19 +21,6 @@ index eb16211..3a34840 100644
# Since tilde.c is shared between readline and bash, make sure we compile # Since tilde.c is shared between readline and bash, make sure we compile
# it with the right flags when it's built as part of readline # it with the right flags when it's built as part of readline
diff --git a/support/shlib-install b/support/shlib-install
index cfec3bd..f4eea27 100755
--- a/support/shlib-install
+++ b/support/shlib-install
@@ -73,7 +73,7 @@ fi
case "$host_os" in
hpux*|darwin*|macosx*|linux*|solaris2*)
if [ -z "$uninstall" ]; then
- chmod 555 ${INSTALLDIR}/${LIBNAME}
+ chmod 755 ${INSTALLDIR}/${LIBNAME}
fi ;;
cygwin*|mingw*)
IMPLIBNAME=`echo ${LIBNAME} \
diff --git a/support/shobj-conf b/support/shobj-conf diff --git a/support/shobj-conf b/support/shobj-conf
index 1f64433..40827a4 100644 index 1f64433..40827a4 100644
--- a/support/shobj-conf --- a/support/shobj-conf

BIN
readline-8.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,20 +1,19 @@
Name: readline Name: readline
Version: 7.0 Version: 8.0
Release: 13 Release: 1
Summary: Readline library for editing typed command lines Summary: Readline library for editing typed command lines
License: GPLv3+ License: GPLv3+
URL: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html 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 Source0: http://git.savannah.gnu.org/cgit/readline.git/snapshot/%{name}-%{version}.tar.gz
Patch1: Readline-7.0-patch-1.patch Patch0: readline-8.0-shlib.patch
Patch2: Readline-7.0-patch-2.patch Patch1: fix-file-descriptor-leak-with-z.patch
Patch3: Readline-7.0-patch-3.patch Patch2: fix-problems-moving-back-beyond-start-of-history.patch
Patch4: Readline-7.0-patch-4.patch Patch3: reading-history-entries-with-timestamps-can-result-i.patch
Patch5: Readline-7.0-patch-5.patch Patch4: problems-restoring-the-history-file-are-not-signaled.patch
Patch6: readline-7.0-shlib.patch
BuildRequires: gcc gcc-c++ ncurses-devel BuildRequires: gcc gcc-c++ ncurses-devel readline
%description %description
The GNU Readline library provides a set of functions for use by The GNU Readline library provides a set of functions for use by
@ -52,11 +51,12 @@ Man pages and other related documents for %{name}.
%build %build
export CPPFLAGS="-I%{_includedir}/ncurses" export CPPFLAGS="-I%{_includedir}/ncurses"
%configure %configure --with-curses
%make_build %make_build
%install %install
%make_install %make_install
cp -a %{_libdir}/lib{readline,history}.so.7* %{buildroot}%{_libdir}
%ldconfig_scriptlets %ldconfig_scriptlets
@ -70,6 +70,7 @@ export CPPFLAGS="-I%{_includedir}/ncurses"
%{_includedir}/%{name}/*.h %{_includedir}/%{name}/*.h
%{_libdir}/libhistory.so %{_libdir}/libhistory.so
%{_libdir}/libreadline.so %{_libdir}/libreadline.so
%{_libdir}/pkgconfig/%{name}.pc
%{_docdir}/%{name}/* %{_docdir}/%{name}/*
%{_datadir}/%{name} %{_datadir}/%{name}
%{_libdir}/*.a %{_libdir}/*.a
@ -83,5 +84,8 @@ export CPPFLAGS="-I%{_includedir}/ncurses"
%changelog %changelog
* Mon Jul 13 2020 wangchen <wangchen137@huawei.com> - 8.0-1
- update to 8.0
* Thu Aug 22 2019 openEuler Buildteam <buildteam@openeuler.org> - 7.0-13 * Thu Aug 22 2019 openEuler Buildteam <buildteam@openeuler.org> - 7.0-13
- Package init - Package init