changeset 7042:142471155843

readline: update to 8.2 patch level 10 Add upstream patches for readline. * dist-files.mk: Update list with new patches.
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 17 Jan 2024 14:32:33 +0100
parents 4412a1c8db94
children cc9e6410c847
files dist-files.mk src/readline-0-001-fix-crash-when-readline-is-star.patch src/readline-0-002-avoid-possible-crash-when-tryin.patch src/readline-0-003-fix-typo-when-specifying-readli.patch src/readline-0-004-fix-compilation-on-systems-that.patch src/readline-0-005-fix-for-callback-signal-handlin.patch src/readline-0-006-fix-for-callback-signal-handlin.patch src/readline-0-007-display-newline-if-readline-is-.patch src/readline-0-008-add-missing-function-prototypes.patch src/readline-0-009-fix-issue-where-directory-name-.patch src/readline-0-010-fix-issue-where-comparing-quot.patch
diffstat 11 files changed, 192 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Tue Jan 16 09:51:58 2024 -0500
+++ b/dist-files.mk	Wed Jan 17 14:32:33 2024 +0100
@@ -669,6 +669,9 @@
   readline-0-005-fix-for-callback-signal-handlin.patch \
   readline-0-006-fix-for-callback-signal-handlin.patch \
   readline-0-007-display-newline-if-readline-is-.patch \
+  readline-0-008-add-missing-function-prototypes.patch \
+  readline-0-009-fix-issue-where-directory-name-.patch \
+  readline-0-010-fix-issue-where-comparing-quot.patch \
   readline-1-display.patch \
   readline-1-fixes.patch \
   readline-1-sigwinch.patch \
--- a/src/readline-0-001-fix-crash-when-readline-is-star.patch	Tue Jan 16 09:51:58 2024 -0500
+++ b/src/readline-0-001-fix-crash-when-readline-is-star.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -1,8 +1,8 @@
 From 7274faabe97ce53d6b464272d7e6ab6c1392837b Mon Sep 17 00:00:00 2001
 From: Chet Ramey <chet.ramey@case.edu>
 Date: Wed, 5 Oct 2022 10:41:16 -0400
-Subject: [PATCH 1/7] Readline-8.2 patch 1: fix crash when readline is started
- with an invalid locale specification
+Subject: [PATCH 01/10] Readline-8.2 patch 1: fix crash when readline is
+ started with an invalid locale specification
 
 ---
  nls.c        |   4 ++++
--- a/src/readline-0-002-avoid-possible-crash-when-tryin.patch	Tue Jan 16 09:51:58 2024 -0500
+++ b/src/readline-0-002-avoid-possible-crash-when-tryin.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -1,8 +1,8 @@
 From 83de95eaba5debdf544d0ef43cf88de3bc5cd7dd Mon Sep 17 00:00:00 2001
 From: Chet Ramey <chet.ramey@case.edu>
 Date: Fri, 17 Nov 2023 16:00:59 -0500
-Subject: [PATCH 2/7] Readline-8.2 patch 2: avoid possible crash when trying to
- zero out a line buffer that's potentially not null-terminated
+Subject: [PATCH 02/10] Readline-8.2 patch 2: avoid possible crash when trying
+ to zero out a line buffer that's potentially not null-terminated
 
 ---
  display.c  | 7 ++-----
--- a/src/readline-0-003-fix-typo-when-specifying-readli.patch	Tue Jan 16 09:51:58 2024 -0500
+++ b/src/readline-0-003-fix-typo-when-specifying-readli.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -1,8 +1,8 @@
 From ba77167d33ba8eca87f1315c39f4181cc1e7aeae Mon Sep 17 00:00:00 2001
 From: Chet Ramey <chet.ramey@case.edu>
 Date: Fri, 17 Nov 2023 16:01:56 -0500
-Subject: [PATCH 3/7] Readline-8.2 patch 3: fix typo when specifying readline's
- custom color prefix
+Subject: [PATCH 03/10] Readline-8.2 patch 3: fix typo when specifying
+ readline's custom color prefix
 
 ---
  colors.c   | 2 +-
--- a/src/readline-0-004-fix-compilation-on-systems-that.patch	Tue Jan 16 09:51:58 2024 -0500
+++ b/src/readline-0-004-fix-compilation-on-systems-that.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -1,7 +1,7 @@
 From c59116b15d95a94a9a2dd8ce5fe08850e004411a Mon Sep 17 00:00:00 2001
 From: Chet Ramey <chet.ramey@case.edu>
 Date: Fri, 17 Nov 2023 16:02:46 -0500
-Subject: [PATCH 4/7] Readline-8.2 patch 4: fix compilation on systems that
+Subject: [PATCH 04/10] Readline-8.2 patch 4: fix compilation on systems that
  provide select or pselect but not both
 
 ---
--- a/src/readline-0-005-fix-for-callback-signal-handlin.patch	Tue Jan 16 09:51:58 2024 -0500
+++ b/src/readline-0-005-fix-for-callback-signal-handlin.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -1,7 +1,7 @@
 From 37ec317397e442ee8616b3b2aa81bfb8dde71a06 Mon Sep 17 00:00:00 2001
 From: Chet Ramey <chet.ramey@case.edu>
 Date: Fri, 17 Nov 2023 16:04:13 -0500
-Subject: [PATCH 5/7] Readline-8.2 patch 5: fix for callback signal handling
+Subject: [PATCH 05/10] Readline-8.2 patch 5: fix for callback signal handling
  when a signal arrives after readline checks but before it restores the
  application's signal handlers
 
--- a/src/readline-0-006-fix-for-callback-signal-handlin.patch	Tue Jan 16 09:51:58 2024 -0500
+++ b/src/readline-0-006-fix-for-callback-signal-handlin.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -1,7 +1,7 @@
 From 93a6afa50f953246f7c0f93b219a1e4010ba704b Mon Sep 17 00:00:00 2001
 From: Chet Ramey <chet.ramey@case.edu>
 Date: Fri, 17 Nov 2023 16:05:13 -0500
-Subject: [PATCH 6/7] Readline-8.2 patch 6: fix for callback signal handling
+Subject: [PATCH 06/10] Readline-8.2 patch 6: fix for callback signal handling
  when a signal arrives before readline calls rl_getc and handling it changes
  callback state
 
--- a/src/readline-0-007-display-newline-if-readline-is-.patch	Tue Jan 16 09:51:58 2024 -0500
+++ b/src/readline-0-007-display-newline-if-readline-is-.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -1,7 +1,7 @@
 From bfe9c573a9e376323929c80b2b71c59727fab0cc Mon Sep 17 00:00:00 2001
 From: Chet Ramey <chet.ramey@case.edu>
 Date: Fri, 17 Nov 2023 16:06:49 -0500
-Subject: [PATCH 7/7] Readline-8.2 patch 7: display newline if readline is
+Subject: [PATCH 07/10] Readline-8.2 patch 7: display newline if readline is
  called without a prompt string and return is typed on a single empty line
 
 ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/readline-0-008-add-missing-function-prototypes.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -0,0 +1,67 @@
+From cef614441f99b7b6e444ba601d8465a6e88f5a98 Mon Sep 17 00:00:00 2001
+From: Chet Ramey <chet.ramey@case.edu>
+Date: Sun, 14 Jan 2024 15:19:37 -0500
+Subject: [PATCH 08/10] Readline-8.2 patch 8: add missing function prototypes
+
+---
+ bind.c     | 4 +---
+ patchlevel | 2 +-
+ rltty.c    | 3 +--
+ text.c     | 3 +--
+ 4 files changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/bind.c b/bind.c
+index 971116a..2596006 100644
+--- a/bind.c
++++ b/bind.c
+@@ -1167,9 +1167,7 @@ _rl_init_file_error (va_alist)
+ /* **************************************************************** */
+ 
+ static int
+-parse_comparison_op (s, indp)
+-     const char *s;
+-     int *indp;
++parse_comparison_op (const char *s, int *indp)
+ {
+   int i, peekc, op;
+ 
+diff --git a/patchlevel b/patchlevel
+index e340b58..6c10f12 100644
+--- a/patchlevel
++++ b/patchlevel
+@@ -1,3 +1,3 @@
+ # Do not edit -- exists only for use by patch
+ 
+-7
++8
+diff --git a/rltty.c b/rltty.c
+index 882a3d4..a4863ac 100644
+--- a/rltty.c
++++ b/rltty.c
+@@ -80,8 +80,7 @@ static int ksrflow;
+ /* Dummy call to force a backgrounded readline to stop before it tries
+    to get the tty settings. */
+ static void
+-set_winsize (tty)
+-     int tty;
++set_winsize (int tty)
+ {
+ #if defined (TIOCGWINSZ)
+   struct winsize w;
+diff --git a/text.c b/text.c
+index 91c3f33..30fdaa1 100644
+--- a/text.c
++++ b/text.c
+@@ -1764,8 +1764,7 @@ _rl_char_search (int count, int fdir, int bdir)
+ 
+ #if defined (READLINE_CALLBACKS)
+ static int
+-_rl_char_search_callback (data)
+-     _rl_callback_generic_arg *data;
++_rl_char_search_callback (_rl_callback_generic_arg *data)
+ {
+   _rl_callback_func = 0;
+   _rl_want_redisplay = 1;
+-- 
+2.38.0.windows.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/readline-0-009-fix-issue-where-directory-name-.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -0,0 +1,57 @@
+From 3853739c28a9777d30ff65e8448e8f1a2898f3f2 Mon Sep 17 00:00:00 2001
+From: Chet Ramey <chet.ramey@case.edu>
+Date: Sun, 14 Jan 2024 15:20:44 -0500
+Subject: [PATCH 09/10] Readline-8.2 patch 9: fix issue where directory name
+ being completed needs both tilde expansion and dequoting
+
+---
+ complete.c | 14 ++++++++++----
+ patchlevel |  2 +-
+ 2 files changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/complete.c b/complete.c
+index e5d224e..c9e0098 100644
+--- a/complete.c
++++ b/complete.c
+@@ -2526,7 +2526,8 @@ rl_filename_completion_function (const char *text, int state)
+ 	  temp = tilde_expand (dirname);
+ 	  xfree (dirname);
+ 	  dirname = temp;
+-	  tilde_dirname = 1;
++	  if (*dirname != '~')
++	    tilde_dirname = 1;	/* indicate successful tilde expansion */
+ 	}
+ 
+       /* We have saved the possibly-dequoted version of the directory name
+@@ -2545,11 +2546,16 @@ rl_filename_completion_function (const char *text, int state)
+ 	  xfree (users_dirname);
+ 	  users_dirname = savestring (dirname);
+ 	}
+-      else if (tilde_dirname == 0 && rl_completion_found_quote && rl_filename_dequoting_function)
++      else if (rl_completion_found_quote && rl_filename_dequoting_function)
+ 	{
+-	  /* delete single and double quotes */
++	  /* 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 = savestring (users_dirname);
++	  dirname = temp;
+ 	}
+       directory = opendir (dirname);
+ 
+diff --git a/patchlevel b/patchlevel
+index 6c10f12..c0ac809 100644
+--- a/patchlevel
++++ b/patchlevel
+@@ -1,3 +1,3 @@
+ # Do not edit -- exists only for use by patch
+ 
+-8
++9
+-- 
+2.38.0.windows.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/readline-0-010-fix-issue-where-comparing-quot.patch	Wed Jan 17 14:32:33 2024 +0100
@@ -0,0 +1,55 @@
+From 5d4d92f221d6aac4be445bdd8cd9b48d9ac33f04 Mon Sep 17 00:00:00 2001
+From: Chet Ramey <chet.ramey@case.edu>
+Date: Sun, 14 Jan 2024 15:22:07 -0500
+Subject: [PATCH 10/10] Readline-8.2 patch 10: fix issue where comparing quoted
+ and unquoted words to be completed results in readline not displaying
+ possible matches
+
+---
+ complete.c | 18 +++++++++++++++++-
+ patchlevel |  2 +-
+ 2 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/complete.c b/complete.c
+index c9e0098..70a0a60 100644
+--- a/complete.c
++++ b/complete.c
+@@ -2031,9 +2031,25 @@ rl_complete_internal (int what_to_do)
+ 
+   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. */
+-  nontrivial_lcd = matches && compare_match (text, matches[0]) != 0;
++  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);
+   xfree (text);
+diff --git a/patchlevel b/patchlevel
+index c0ac809..810c277 100644
+--- a/patchlevel
++++ b/patchlevel
+@@ -1,3 +1,3 @@
+ # Do not edit -- exists only for use by patch
+ 
+-9
++10
+-- 
+2.38.0.windows.1
+