diff --git a/get_version_number.sh b/get_version_number.sh new file mode 100644 index 0000000..c2ea701 --- /dev/null +++ b/get_version_number.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Note: this file is used in the spec file, do not remove it +# Print the highest version number of the patches from the archive +sourcedir=$1 +test -n "${sourcedir}" || sourcedir=$PWD +test -e ${sourcedir}/readline.spec || exit 1 +version=$(sed -rn '/^%define[[:space:]]+rversion/{s/^%define[[:space:]]+rversion[[:space:]]+([0-9]+\.[0-9]+)(\.[^\.]+)?/\1/p}' ${sourcedir}/readline.spec) || exit 1 +test -e ${sourcedir}/readline-${version}.tar.gz || exit 1 +last=($(tar Oxf ${sourcedir}/readline-${version}.tar.gz readline-${version}/configure.ac | sed -rn '/^LIBVERSION/{s/LIBVERSION=//p}')) || exit 1 +for p in ${sourcedir}/readline${last//\./}-*[0-9] +do + level=${p##*-} +done +shopt -s extglob +echo ${level##+(0)} diff --git a/readline-5.2-conf.patch b/readline-5.2-conf.patch index 9c7dff7..2d7fb3c 100644 --- a/readline-5.2-conf.patch +++ b/readline-5.2-conf.patch @@ -80,7 +80,7 @@ #if defined (__MSDOS__) if (_rl_read_init_file (filename, 0) == 0) return 0; -@@ -1811,7 +1838,14 @@ rl_parse_and_bind (char *string) +@@ -1809,7 +1836,14 @@ rl_parse_and_bind (char *string) rl_macro_bind (seq, &funname[1], _rl_keymap); } else @@ -96,7 +96,7 @@ xfree (seq); return 0; -@@ -1985,7 +2019,6 @@ typedef int _rl_sv_func_t (const char *) +@@ -1983,7 +2017,6 @@ typedef int _rl_sv_func_t (const char *) /* Forward declarations */ static int sv_region_start_color (const char *); static int sv_region_end_color (const char *); diff --git a/readline-6.2-metamode.patch b/readline-6.2-metamode.patch index f5fafe8..db2c145 100644 --- a/readline-6.2-metamode.patch +++ b/readline-6.2-metamode.patch @@ -4,7 +4,7 @@ --- lib/readline/bind.c +++ lib/readline/bind.c 2018-09-20 06:40:06.799183658 +0000 -@@ -1958,6 +1958,7 @@ static const struct { +@@ -1956,6 +1956,7 @@ static const struct { #if defined (VISIBLE_STATS) { "visible-stats", &rl_visible_stats, 0 }, #endif /* VISIBLE_STATS */ diff --git a/readline-7.0-screen.patch b/readline-7.0-screen.patch index 46598da..7d7c348 100644 --- a/readline-7.0-screen.patch +++ b/readline-7.0-screen.patch @@ -10,7 +10,7 @@ This helps to get /etc/inputrc work for most users. --- lib/readline/bind.c +++ lib/readline/bind.c 2019-08-16 08:26:42.327029248 +0000 -@@ -1313,19 +1313,34 @@ parser_if (char *args) +@@ -1311,19 +1311,34 @@ parser_if (char *args) word in ARGS is the same as the value stored in rl_readline_name. */ if (rl_terminal_name && _rl_strnicmp (args, "term=", 5) == 0) { diff --git a/readline-8.2.dif b/readline-8.2.dif index 8cd021e..582ea7f 100644 --- a/readline-8.2.dif +++ b/readline-8.2.dif @@ -43,7 +43,7 @@ { scan = rl_line_buffer[rl_point]; -@@ -2216,7 +2216,7 @@ rl_completion_matches (const char *text, +@@ -2232,7 +2232,7 @@ rl_completion_matches (const char *text, match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *)); match_list[1] = (char *)NULL; @@ -52,7 +52,7 @@ { if (RL_SIG_RECEIVED ()) { -@@ -2288,7 +2288,7 @@ rl_username_completion_function (const c +@@ -2304,7 +2304,7 @@ rl_username_completion_function (const c } #if defined (HAVE_GETPWENT) diff --git a/readline.changes b/readline.changes index eea838f..a2d9c9e 100644 --- a/readline.changes +++ b/readline.changes @@ -1,3 +1,25 @@ +------------------------------------------------------------------- +Tue Jan 16 07:49:48 UTC 2024 - Dr. Werner Fink + +- Add upstream patch readline82-008 + * Add missing prototypes for several function declarations +- Add upstream patch readline82-009 + * Fix issue where the directory name portion of the word to be + completed (the part that is passed to opendir()) requires both + tilde expansion and dequoting. Readline only performed tilde + expansion in this case, so filename completion would fail. +- Add upstream patch readline82-010 + * Fix the case where text to be completed from the line buffer + (quoted) is compared to the common prefix of the possible + matches (unquoted) and the quoting makes the former appear to + be longer than the latter. Readline assumes the match doesn't + add any characters to the word and doesn't display multiple matches. +- Port patches + * readline-5.2-conf.patch + * readline-6.2-metamode.patch + * readline-7.0-screen.patch + * readline-8.2.dif + ------------------------------------------------------------------- Tue Nov 21 07:04:06 UTC 2023 - Dr. Werner Fink diff --git a/readline.spec b/readline.spec index 18df3fa..983a166 100644 --- a/readline.spec +++ b/readline.spec @@ -1,7 +1,7 @@ # # spec file for package readline # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,18 +18,21 @@ %define rl_major 8 %define rextend %{nil} +%define rversion 8.2 +%define rpatchlvl %(bash %{_sourcedir}/get_version_number.sh %{_sourcedir}) Name: readline -Version: 8.2 +Version: %{rversion}.%{rpatchlvl} Release: 0 Summary: The readline library License: GPL-3.0-or-later Group: Development/Libraries/C and C++ URL: https://www.gnu.org/software/readline/ # Git: http://git.savannah.gnu.org/cgit/bash.git -Source0: https://ftp.gnu.org/gnu/readline/readline-%{version}%{rextend}.tar.gz -Source1: https://ftp.gnu.org/gnu/readline/readline-%{version}%{rextend}.tar.gz.sig +Source0: https://ftp.gnu.org/gnu/readline/readline-%{rversion}%{rextend}.tar.gz +Source1: https://ftp.gnu.org/gnu/readline/readline-%{rversion}%{rextend}.tar.gz.sig Source2: baselibs.conf +Source3: get_version_number.sh Source4: https://tiswww.case.edu/php/chet/gpgkey.asc#/%{name}.keyring # signatures for official patches # official patches @@ -40,6 +43,9 @@ Patch104: readline82-004 Patch105: readline82-005 Patch106: readline82-006 Patch107: readline82-007 +Patch108: readline82-008 +Patch109: readline82-009 +Patch110: readline82-010 Source101: readline82-001.sig Source102: readline82-002.sig Source103: readline82-003.sig @@ -47,8 +53,11 @@ Source104: readline82-004.sig Source105: readline82-005.sig Source106: readline82-006.sig Source107: readline82-007.sig +Source108: readline82-008.sig +Source109: readline82-009.sig +Source110: readline82-010.sig # local patches -Patch200: readline-%{version}.dif +Patch200: readline-%{rversion}.dif Patch201: readline-6.3-input.dif Patch202: readline-5.2-conf.patch Patch203: readline-6.2-metamode.patch @@ -75,7 +84,8 @@ Summary: The Readline Library Group: System/Libraries Suggests: readline-doc = %{version} Provides: bash:/%{_lib}/libreadline.so.%{rl_major} -Provides: readline = %{version} +Provides: libreadline%{rl_major} = %{rversion} +Provides: readline = %{rversion} Obsoletes: readline <= 6.3 %description -n libreadline%{rl_major} @@ -86,7 +96,8 @@ includes history and search functionality. %package devel Summary: Development files for readline Group: Development/Libraries/C and C++ -Requires: libreadline%{rl_major} = %{version} +Provides: pkgconfig(readline) = %{rversion} +Requires: libreadline%{rl_major} >= %{rversion} Requires: ncurses-devel Recommends: readline-doc = %{version} @@ -115,7 +126,7 @@ This package contains the documentation for using the readline library as well as programming with the interface of the readline library. %prep -%setup -q -n readline-%{version}%{rextend} +%setup -q -n readline-%{rversion}%{rextend} # official patches %patch -P101 -p0 %patch -P102 -p0 @@ -124,6 +135,9 @@ as well as programming with the interface of the readline library. %patch -P105 -p0 %patch -P106 -p0 %patch -P107 -p0 +%patch -P108 -p0 +%patch -P109 -p0 +%patch -P110 -p0 # local patches %patch -P201 -p2 -b .zerotty %patch -P202 -p2 -b .conf @@ -240,7 +254,7 @@ LARGEFILE="$(getconf LFS_CFLAGS)" found=0 for rl in %{_libdir}/libreadline.so.*.* do - test READLINE_${rl##/*.so.} = READLINE_%{version} && found=1 + test READLINE_${rl##/*.so.} = READLINE_%{rversion} && found=1 done if test $found = 0 then @@ -292,9 +306,9 @@ export CC_FOR_BUILD CFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD CFLAGS LDFLAGS CC %files -n libreadline%{rl_major} %license COPYING %{_libdir}/libhistory.so.%{rl_major} -%{_libdir}/libhistory.so.%{version} +%{_libdir}/libhistory.so.%{rversion} %{_libdir}/libreadline.so.%{rl_major} -%{_libdir}/libreadline.so.%{version} +%{_libdir}/libreadline.so.%{rversion} %files devel %{_includedir}/readline/ diff --git a/readline82-008 b/readline82-008 new file mode 100644 index 0000000..a62ff55 --- /dev/null +++ b/readline82-008 @@ -0,0 +1,77 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 8.2 +Patch-ID: readline82-008 + +Bug-Reported-by: +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +Add missing prototypes for several function declarations. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/text.c Wed Oct 27 11:03:59 2021 +--- text.c Thu Nov 16 16:24:58 2023 +*************** +*** 1765,1770 **** + #if defined (READLINE_CALLBACKS) + static int +! _rl_char_search_callback (data) +! _rl_callback_generic_arg *data; + { + _rl_callback_func = 0; +--- 1765,1769 ---- + #if defined (READLINE_CALLBACKS) + static int +! _rl_char_search_callback (_rl_callback_generic_arg *data) + { + _rl_callback_func = 0; +*** ../readline-8.2-patched/bind.c Wed Feb 9 11:02:22 2022 +--- bind.c Thu Nov 16 16:25:17 2023 +*************** +*** 1168,1174 **** + + static int +! parse_comparison_op (s, indp) +! const char *s; +! int *indp; + { + int i, peekc, op; +--- 1168,1172 ---- + + static int +! parse_comparison_op (const char *s, int *indp) + { + int i, peekc, op; +*** ../readline-8.2-patched/rltty.c Fri Feb 18 11:14:22 2022 +--- rltty.c Thu Nov 16 16:25:36 2023 +*************** +*** 81,86 **** + to get the tty settings. */ + static void +! set_winsize (tty) +! int tty; + { + #if defined (TIOCGWINSZ) +--- 81,85 ---- + to get the tty settings. */ + static void +! set_winsize (int tty) + { + #if defined (TIOCGWINSZ) + +*** ../readline-8.2/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 + +! 7 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 8 diff --git a/readline82-008.sig b/readline82-008.sig new file mode 100644 index 0000000..abd0782 Binary files /dev/null and b/readline82-008.sig differ diff --git a/readline82-009 b/readline82-009 new file mode 100644 index 0000000..3e36c56 --- /dev/null +++ b/readline82-009 @@ -0,0 +1,73 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 8.2 +Patch-ID: readline82-009 + +Bug-Reported-by: Stefan H. Holek +Bug-Reference-ID: <50F8DA45-B7F3-4DE1-AB94-19AE42649CDC@epy.co.at> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2022-10/msg00021.html + +Bug-Description: + +Fix issue where the directory name portion of the word to be completed (the +part that is passed to opendir()) requires both tilde expansion and dequoting. +Readline only performed tilde expansion in this case, so filename completion +would fail. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/complete.c 2022-04-05 10:47:06.000000000 -0400 +--- complete.c 2022-10-26 15:08:51.000000000 -0400 +*************** +*** 2527,2531 **** + xfree (dirname); + dirname = temp; +! tilde_dirname = 1; + } + +--- 2527,2532 ---- + xfree (dirname); + dirname = temp; +! if (*dirname != '~') +! tilde_dirname = 1; /* indicate successful tilde expansion */ + } + +*************** +*** 2546,2554 **** + users_dirname = savestring (dirname); + } +! else if (tilde_dirname == 0 && rl_completion_found_quote && rl_filename_dequoting_function) + { +! /* delete single and double quotes */ + xfree (dirname); +! dirname = savestring (users_dirname); + } + directory = opendir (dirname); +--- 2547,2560 ---- + users_dirname = savestring (dirname); + } +! else if (rl_completion_found_quote && rl_filename_dequoting_function) + { +! /* We already ran users_dirname through the dequoting function. +! If tilde_dirname == 1, we successfully performed tilde expansion +! on dirname. Now we need to reconcile those results. We either +! just copy the already-dequoted users_dirname or tilde expand it +! if we tilde-expanded dirname. */ +! temp = tilde_dirname ? tilde_expand (users_dirname) : savestring (users_dirname); + xfree (dirname); +! dirname = temp; + } + directory = opendir (dirname); + +*** ../readline-8.2/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 + +! 8 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 9 diff --git a/readline82-009.sig b/readline82-009.sig new file mode 100644 index 0000000..a4d4295 Binary files /dev/null and b/readline82-009.sig differ diff --git a/readline82-010 b/readline82-010 new file mode 100644 index 0000000..e6b6de3 --- /dev/null +++ b/readline82-010 @@ -0,0 +1,67 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 8.2 +Patch-ID: readline82-010 + +Bug-Reported-by: Martin Castillo +Bug-Reference-ID: <2d42153b-cf65-caba-dff1-cd3bc6268c7e@uni-bremen.de> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2023-01/msg00000.html + +Bug-Description: + +Fix the case where text to be completed from the line buffer (quoted) is +compared to the common prefix of the possible matches (unquoted) and the +quoting makes the former appear to be longer than the latter. Readline +assumes the match doesn't add any characters to the word and doesn't display +multiple matches. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/complete.c Tue Apr 5 10:47:06 2022 +--- complete.c Sat Jan 7 14:19:45 2023 +*************** +*** 2032,2038 **** + text = rl_copy_text (start, end); + matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char); + /* nontrivial_lcd is set if the common prefix adds something to the word + being completed. */ +! nontrivial_lcd = matches && compare_match (text, matches[0]) != 0; + if (what_to_do == '!' || what_to_do == '@') + tlen = strlen (text); +--- 2038,2060 ---- + text = rl_copy_text (start, end); + matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char); ++ /* If TEXT contains quote characters, it will be dequoted as part of ++ generating the matches, and the matches will not contain any quote ++ characters. We need to dequote TEXT before performing the comparison. ++ Since compare_match performs the dequoting, and we only want to do it ++ once, we don't call compare_matches after dequoting TEXT; we call ++ strcmp directly. */ + /* nontrivial_lcd is set if the common prefix adds something to the word + being completed. */ +! if (rl_filename_completion_desired && rl_filename_quoting_desired && +! rl_completion_found_quote && rl_filename_dequoting_function) +! { +! char *t; +! t = (*rl_filename_dequoting_function) (text, rl_completion_quote_character); +! xfree (text); +! text = t; +! nontrivial_lcd = matches && strcmp (text, matches[0]) != 0; +! } +! else +! nontrivial_lcd = matches && strcmp (text, matches[0]) != 0; + if (what_to_do == '!' || what_to_do == '@') + tlen = strlen (text); + +*** ../readline-8.2/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 + +! 9 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 10 diff --git a/readline82-010.sig b/readline82-010.sig new file mode 100644 index 0000000..36308b0 Binary files /dev/null and b/readline82-010.sig differ