Re: [PATCH] negative arg trimming

2023-11-21 Thread Grisha Levit
On Tue, Nov 21, 2023, 00:57 Grisha Levit  wrote:

> rl_trim_arg_from_keyseq fails to trim a negative argument entered with
> universal-argument and fails to trim arguments if they have multiple
> leading minus signs.
>

Also fails if the function to be executed is shadowed by a key map:

bind '"XX": "foo"'
bind -x '"X": ":"'

Followed by: "\e2X":

bash: bash_execute_unix_command: cannot find keymap for command

>
From 73a6f6d9a462dccf2afd924dc2444d27d76747f9 Mon Sep 17 00:00:00 2001
From: Grisha Levit 
Date: Tue, 21 Nov 2023 13:27:08 -0500
Subject: [PATCH 2/2] arg trim with ANYOTHERKEY

---
 lib/readline/bind.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/readline/bind.c b/lib/readline/bind.c
index 1c347fbe..c7ce35d5 100644
--- a/lib/readline/bind.c
+++ b/lib/readline/bind.c
@@ -874,7 +874,7 @@ int
 rl_trim_arg_from_keyseq	(const char *keyseq, size_t len, Keymap map)
 {
   register int i, j, parsing_digits;
-  unsigned char ic;
+  unsigned int ic;
   Keymap map0;
 
   if (map == 0)
@@ -906,10 +906,11 @@ rl_trim_arg_from_keyseq	(const char *keyseq, size_t len, Keymap map)
 
   if (map[ic].type == ISKMAP)
 	{
-	  if (i + 1 == len)
-	return -1;
 	  map = FUNCTION_TO_KEYMAP (map, ic);
-	  continue;
+	  if (i + 1 == len)
+	ic = ANYOTHERKEY;
+	  else
+	continue;
 	}
   if (map[ic].type == ISFUNC)
 	{
-- 
2.43.0



[PATCH] small doc typos

2023-11-21 Thread Grisha Levit
diff --git a/doc/bash.1 b/doc/bash.1
index 901794c1..595ff977 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -2290,7 +2290,7 @@ Control how the results of pathname expansion are
sorted.
 The value of this variable specifies the sort criteria and sort order for
 the results of pathname expansion.
 If this variable is unset or set to the null string, pathname expansion
-uses the historial behavior of sorting by name.
+uses the historical behavior of sorting by name.
 If set, a valid value begins with an optional \fI+\fP, which is ignored,
 or \fI\-\fP, which reverses the sort order from ascending to descending,
 followed by a sort specifier.
diff --git a/doc/bashref.texi b/doc/bashref.texi
index 41db2ed5..747b0cf9 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -6645,7 +6645,7 @@ Control how the results of filename expansion are
sorted.
 The value of this variable specifies the sort criteria and sort order for
 the results of filename expansion.
 If this variable is unset or set to the null string, filename expansion
-uses the historial behavior of sorting by name.
+uses the historical behavior of sorting by name.
 If set, a valid value begins with an optional @samp{+}, which is ignored,
 or @samp{-}, which reverses the sort order from ascending to descending,
 followed by a sort specifier.
@@ -9859,7 +9859,7 @@ Include support for importing function definitions
exported by another
 instance of the shell from the environment. This option is enabled by
 default.

-@item --enable-glob-asciirange-default
+@item --enable-glob-asciiranges-default
 Set the default value of the @code{globasciiranges} shell option described
 above under @ref{The Shopt Builtin} to be enabled.
 This controls the behavior of character ranges when used in pattern
matching