From 17d1fd7403f2c71acbcef3e816e5838325cf58e1 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 6 Jan 2024 05:34:22 +0100 Subject: [PATCH] legacy package [release 7.0.005-2mamba;Sun Mar 03 2019] --- README.md | 4 + libreadline-6.2-shlib.patch | 41 ++++ libreadline-7.0.005-patchset.patch | 305 +++++++++++++++++++++++++++++ libreadline-autoupdate | 11 ++ libreadline7.spec | 192 ++++++++++++++++++ 5 files changed, 553 insertions(+) create mode 100644 libreadline-6.2-shlib.patch create mode 100644 libreadline-7.0.005-patchset.patch create mode 100644 libreadline-autoupdate create mode 100644 libreadline7.spec diff --git a/README.md b/README.md index 165fd32..439534e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # libreadline7 +The Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. +Both Emacs and vi editing modes are available. +The Readline library includes additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history expansion on previous commands. + diff --git a/libreadline-6.2-shlib.patch b/libreadline-6.2-shlib.patch new file mode 100644 index 0000000..3b0cb3d --- /dev/null +++ b/libreadline-6.2-shlib.patch @@ -0,0 +1,41 @@ +diff -up readline-6.2/shlib/Makefile.in.shlib readline-6.2/shlib/Makefile.in +--- readline-6.2/shlib/Makefile.in.shlib 2010-12-28 21:56:21.000000000 +0100 ++++ readline-6.2/shlib/Makefile.in 2011-02-14 17:34:38.821537496 +0100 +@@ -170,7 +170,7 @@ $(SHARED_READLINE): $(SHARED_OBJ) + + $(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so xfree.so + $(RM) $@ +- $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so xfree.so $(SHLIB_LIBS) ++ $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so xfree.so + + # 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 +diff -up readline-6.2/support/shlib-install.shlib readline-6.2/support/shlib-install +--- readline-6.2/support/shlib-install.shlib 2009-10-28 14:30:18.000000000 +0100 ++++ readline-6.2/support/shlib-install 2011-02-14 17:33:07.611768164 +0100 +@@ -72,7 +72,7 @@ fi + case "$host_os" in + hpux*|darwin*|macosx*|linux*) + if [ -z "$uninstall" ]; then +- chmod 555 ${INSTALLDIR}/${LIBNAME} ++ chmod 755 ${INSTALLDIR}/${LIBNAME} + fi ;; + cygwin*|mingw*) + IMPLIBNAME=`echo ${LIBNAME} \ +diff -up readline-6.2/support/shobj-conf.shlib readline-6.2/support/shobj-conf +--- readline-6.2/support/shobj-conf.shlib 2009-10-28 14:20:21.000000000 +0100 ++++ readline-6.2/support/shobj-conf 2011-02-14 17:33:07.612767986 +0100 +@@ -112,10 +112,11 @@ sunos5*|solaris2*) + linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo) + SHOBJ_CFLAGS=-fPIC + SHOBJ_LD='${CC}' +- SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' ++ SHOBJ_LDFLAGS='$(CFLAGS) -shared -Wl,-soname,$@' + +- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`' ++ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' ++ SHLIB_LIBS='-ltermcap' + ;; + + freebsd2*) diff --git a/libreadline-7.0.005-patchset.patch b/libreadline-7.0.005-patchset.patch new file mode 100644 index 0000000..54756f5 --- /dev/null +++ b/libreadline-7.0.005-patchset.patch @@ -0,0 +1,305 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-001 + +Bug-Reported-by: Sean Zha +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2016-09/msg00107.html + +Bug-Description: + +Readline-7.0 changed the way the history list is initially allocated to reduce +the number of reallocations and copies. Users who set the readline +history-size variable to a very large number to essentially unlimit the size +of the history list will get memory allocation errors + +Patch (apply with `patch -p0'): + +*** ../readline-7.0/history.c 2015-12-28 13:50:31.000000000 -0500 +--- history.c 2016-09-30 14:28:40.000000000 -0400 +*************** +*** 58,61 **** +--- 58,63 ---- + #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 +*************** +*** 308,312 **** + { + if (history_stifled && history_max_entries > 0) +! history_size = history_max_entries + 2; + else + history_size = DEFAULT_HISTORY_INITIAL_SIZE; +--- 310,316 ---- + { + if (history_stifled && history_max_entries > 0) +! history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE) +! ? MAX_HISTORY_INITIAL_SIZE +! : history_max_entries + 2; + else + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 0 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 1 + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-002 + +Bug-Reported-by: Hong Cho +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2016-12/msg00002.html + +Bug-Description: + +There is a race condition in add_history() that can be triggered by a fatal +signal arriving between the time the history length is updated and the time +the history list update is completed. A later attempt to reference an +invalid history entry can cause a crash. + +Patch (apply with `patch -p0'): + +*** ../readline-7.0-patched/history.c 2016-11-11 13:42:49.000000000 -0500 +--- history.c 2016-12-05 10:37:51.000000000 -0500 +*************** +*** 280,283 **** +--- 280,284 ---- + { + HIST_ENTRY *temp; ++ int new_length; + + if (history_stifled && (history_length == history_max_entries)) +*************** +*** 296,306 **** + /* 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 + + history_base++; + } +--- 297,303 ---- + /* Copy the rest of the entries, moving down one slot. Copy includes + trailing NULL. */ + memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *)); + ++ new_length = history_length; + history_base++; + } +*************** +*** 316,320 **** + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *)); +! history_length = 1; + } + else +--- 313,317 ---- + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *)); +! new_length = 1; + } + else +*************** +*** 326,330 **** + xrealloc (the_history, history_size * sizeof (HIST_ENTRY *)); + } +! history_length++; + } + } +--- 323,327 ---- + xrealloc (the_history, history_size * sizeof (HIST_ENTRY *)); + } +! new_length = history_length + 1; + } + } +*************** +*** 332,337 **** + temp = alloc_history_entry ((char *)string, hist_inittime ()); + +! the_history[history_length] = (HIST_ENTRY *)NULL; +! the_history[history_length - 1] = temp; + } + +--- 329,335 ---- + temp = alloc_history_entry ((char *)string, hist_inittime ()); + +! the_history[new_length] = (HIST_ENTRY *)NULL; +! the_history[new_length - 1] = temp; +! history_length = new_length; + } + +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 1 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 2 + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-003 + +Bug-Reported-by: Frédéric Brière +Bug-Reference-ID: <20170120180724.7ydq7fb2hsp366dj@fabul.fbriere.net> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2017-01/msg00002.html + +Bug-Description: + +Readline-7.0 uses pselect(2) to allow readline to handle signals that do not +interrupt read(2), such as SIGALRM, before reading another character. The +signal mask used in the pselect call did not take into account signals the +calling application blocked before calling readline(). + +Patch (apply with `patch -p0'): + +*** ../readline-7.0-patched/input.c 2016-08-30 10:21:47.000000000 -0400 +--- input.c 2017-01-23 10:21:56.000000000 -0500 +*************** +*** 514,517 **** +--- 514,518 ---- + #if defined (HAVE_PSELECT) + sigemptyset (&empty_set); ++ sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &empty_set); + FD_ZERO (&readfds); + FD_SET (fileno (stream), &readfds); +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 2 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 3 + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-004 + +Bug-Reported-by: Kieran Grant +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2018-02/msg00002.html + +Bug-Description: + +With certain values for PS1, especially those that wrap onto three or more +lines, readline will miscalculate the number of invisible characters, +leading to crashes and core dumps. + +Patch (apply with `patch -p0'): + +*** ../readline-7.0.3/display.c 2016-07-28 14:49:33.000000000 -0400 +--- display.c 2018-02-03 19:19:35.000000000 -0500 +*************** +*** 772,776 **** + wadjust = (newlines == 0) + ? prompt_invis_chars_first_line +! : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line); + + /* fix from Darin Johnson for prompt string with +--- 788,794 ---- + wadjust = (newlines == 0) + ? prompt_invis_chars_first_line +! : ((newlines == prompt_lines_estimate) +! ? (wrap_offset - prompt_invis_chars_first_line) +! : 0); + + /* fix from Darin Johnson for prompt string with +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 3 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 4 + + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-005 + +Bug-Reported-by: Nuzhna Pomoshch +Bug-Reference-ID: <1317167476.1492079.1495999776464@mail.yahoo.com> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2017-05/msg00005.html + +Bug-Description: + +There are cases where a failing readline command (e.g., delete-char at the end +of a line) can cause a multi-character key sequence to `back up' and attempt +to re-read some of the characters in the sequence. + +Patch (apply with `patch -p0'): + +*** ../readline-7.0/readline.c 2016-04-20 15:53:52.000000000 -0400 +--- readline.c 2018-05-26 17:19:00.000000000 -0400 +*************** +*** 1058,1062 **** + r = _rl_dispatch (ANYOTHERKEY, m); + } +! else if (r && map[ANYOTHERKEY].function) + { + /* We didn't match (r is probably -1), so return something to +--- 1056,1060 ---- + r = _rl_dispatch (ANYOTHERKEY, m); + } +! else if (r < 0 && map[ANYOTHERKEY].function) + { + /* We didn't match (r is probably -1), so return something to +*************** +*** 1070,1074 **** + return -2; + } +! else if (r && got_subseq) + { + /* OK, back up the chain. */ +--- 1068,1072 ---- + return -2; + } +! else if (r < 0 && got_subseq) /* XXX */ + { + /* OK, back up the chain. */ +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 4 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 5 + diff --git a/libreadline-autoupdate b/libreadline-autoupdate new file mode 100644 index 0000000..2e485f9 --- /dev/null +++ b/libreadline-autoupdate @@ -0,0 +1,11 @@ +#!/bin/bash +VERSION=$1 +MAJRELEASE=`echo $VERSION | cut -d. -f1-2` +MAJRELEASENODOT=`echo $MAJRELEASE | tr -d .` +PATCHRELEASE=`echo $VERSION | cut -d. -f3` +> libreadline-$VERSION-patchset.patch +for i in `seq 001 $PATCHRELEASE`; do + PATCHRELEASEFMT=`printf "%0*d\n" 3 $i` + curl -s ftp://ftp.gnu.org/gnu/readline/readline-$MAJRELEASE-patches/readline$MAJRELEASENODOT-$PATCHRELEASEFMT \ + >> libreadline-$VERSION-patchset.patch || exit 1 +done diff --git a/libreadline7.spec b/libreadline7.spec new file mode 100644 index 0000000..256b908 --- /dev/null +++ b/libreadline7.spec @@ -0,0 +1,192 @@ +%define majver %(echo %version | cut -d. -f1-2) +%define minver %(echo %version | cut -d. -f3) +Name: libreadline7 +Version: 7.0.005 +Release: 2mamba +Summary: Lets users edit command lines as they are typed in +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.gnu.org/directory/GNU/readline.html +Source0: ftp://ftp.gnu.org/gnu/readline/readline-%{majver}.tar.gz +Source1: libreadline-autoupdate +Patch0: libreadline-6.2-shlib.patch +Patch1: libreadline-%{version}-patchset.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +## AUTOBUILDREQ-END +Requires(post):%{__install_info} +Requires(preun): %{__install_info} +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +The Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. +Both Emacs and vi editing modes are available. +The Readline library includes additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history expansion on previous commands. + +%package devel +Group: Development/Libraries +Summary: Development files for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +This package contains libraries and header files for developing applications that use %{name}. + +%package static +Group: Development/Libraries +Summary: Static libraries for the readline library + +%description static +The %{name}-static package contains the static version of the readline library. + +%debug_package + +%prep +%setup -q -n readline-%{majver} +%patch1 -p2 + +%build +%configure +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +# fixup strange shared library permissions +chmod 755 %{buildroot}%{_libdir}/*.so* + +# remove unpackaged files +rm -fr %{buildroot}%{_datadir}/readline + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post +/sbin/ldconfig +exit 0 + +%postun -p /sbin/ldconfig + +%post devel +%install_info history.info +%install_info rluserman.info +%install_info readline.info +exit 0 + +%preun devel +%uninstall_info history.info +%uninstall_info rluserman.info +%uninstall_info readline.info +exit 0 + +%files +%defattr(-,root,root) +%{_libdir}/libhistory.so.* +%{_libdir}/libreadline.so.* +%doc COPYING + +%files devel +%defattr(-,root,root) +%{_libdir}/*.so +%dir %{_includedir}/readline +%{_includedir}/readline/*.h +%{_infodir}/readline.info* +%{_infodir}/history.info* +%{_infodir}/rluserman.info* +%{_mandir}/man3/history.* +%{_mandir}/man3/readline.* +%dir %{_docdir}/readline +%{_docdir}/readline/* +%doc examples/*.c examples/*.h examples/rlfe +%doc CHANGELOG CHANGES NEWS README + +%files static +%defattr(-,root,root) +%{_libdir}/lib*.a + +%changelog +* Sun Mar 03 2019 Silvan Calarco 7.0.005-2mamba +- legacy package + +* Wed Jun 06 2018 Automatic Build System 7.0.005-1mamba +- automatic version update by autodist + +* Wed Mar 08 2017 Automatic Build System 7.0.003-1mamba +- automatic version update by autodist + +* Sun Dec 11 2016 Automatic Build System 7.0.001-1mamba +- automatic version update by autodist + +* Thu Nov 03 2016 Silvan Calarco 7.0-1mamba +- update to 7.0 + +* Thu Dec 18 2014 Silvan Calarco 6.3.008-1mamba +- update to 6.3.008 + +* Tue Jul 22 2014 Silvan Calarco 6.3.006-2mamba +- fix license + +* Thu Jun 05 2014 Automatic Build System 6.3.006-1mamba +- automatic version update by autodist + +* Thu Apr 24 2014 Automatic Build System 6.3.005-1mamba +- automatic version update by autodist + +* Tue Apr 08 2014 Automatic Build System 6.3.003-1mamba +- automatic version update by autodist + +* Fri Mar 21 2014 Silvan Calarco 6.3-1mamba +- update to 6.3 + +* Sat Dec 08 2012 Automatic Build System 6.2.004-1mamba +- update to 6.2.004 + +* Sat Sep 15 2012 Silvan Calarco 6.2-4mamba +- added upstream bugfix patch 001 +- restore shared library patch to fix build of dependent packages + +* Wed May 09 2012 Davide Madrisan 6.2-3mamba +- revert patch0: linking to libtermcap can create problems to other packages + +* Tue May 08 2012 Davide Madrisan 6.2-2mamba +- create subpackage libreadline-static +- move readline.info and manpages to package -devel +- provide a debug package +- obsolete libreadline-doc; this documentation is obsolete +- remove unused patch0 +- add some code examples to devel package +- force linking to libtermcap to avoid several undefined symbols in libreadline +- add build requirements + +* Mon Feb 14 2011 Automatic Build System 6.2-1mamba +- automatic update by autodist + +* Wed Jan 13 2010 Automatic Build System 6.1-1mamba +- automatic update by autodist + +* Sun Mar 22 2009 Silvan Calarco 6.0-1mamba +- automatic update by autodist + +* Fri Sep 14 2007 Silvan Calarco 5.2-2mamba +- added patch with various fixes + +* Fri Oct 13 2006 Davide Madrisan 5.2-1qilnx +- update to version 5.2 by autospec + +* Tue Dec 13 2005 Davide Madrisan 5.1-1qilnx +- update to version 5.1 by autospec +- new compatibility package %{name}43 + +* Fri Sep 09 2005 Davide Madrisan 5.0-2qilnx +- fixed dynamic libraries permissions + +* Thu Sep 08 2005 Davide Madrisan 5.0-1qilnx +- update to version 5.0 by autospec +- several specfile fixes +- new package %{name}.doc + +* Thu Jul 17 2003 Silvan Calarco 4.3-1qilnx +- first build for readline