fix for @ and * as associative array keys in arithmetic expressions; minor readline callback mode changes

This commit is contained in:
Chet Ramey
2022-11-02 16:23:12 -04:00
parent b48c234286
commit 88d69b4fa2
9 changed files with 4198 additions and 3 deletions
+24
View File
@@ -4201,6 +4201,7 @@ subst.c
parse.y
- yylex: return YYUNDEF as current_token if read_token returns < 0.
Fixes parser reset issue reported by Todd Stein <toddbstein@gmail.com>
in https://savannah.gnu.org/support/index.php?110745
subst.c
- ARITH_EXP_CHARS: chars that are special and trigger expansion in
@@ -4267,3 +4268,26 @@ jobs.c
created as long as it's the same as $!, then call reap_procsubs to
clean up the procsub list. Don't call procsub_waitall. Report from
Oguz İsmail Uysal <oguzismailuysal@gmail.com>
10/31
-----
expr.c
- expr_streval: explicitly permit `@' and `*' as associative array
subscripts if the shell compatibility level is greater than 51.
Prompted by report from Corey Hickey <bugfood-ml@fatooh.org>
11/1
----
lib/readline/readline.c
- readline_internal_char: save and restore the value of _rl_top_level
around our use of setjmp, even though it doesn't matter in most
cases. Report from sparrowhawk996@gmail.com that it causes crashes
in some obscure callback-mode cases
lib/readline/isearch.c
- _rl_isearch_dispatch: if we end the search and stuff characters back
to be read again, decrement the current key sequence index by 2 so
we don't have duplicate characters in the sequence
lib/readline/misc.c
- rl_digit_argument: call _rl_del_executing_keyseq after rl_execute_next
+9 -1
View File
@@ -1625,7 +1625,10 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
#endif
#if defined (PROCESS_SUBSTITUTION)
# if defined (JOB_CONTROL)
procsub_clear ();
last_procsub_child = 0;
# endif
clear_fifo_list (); /* XXX- we haven't created any FIFOs */
#endif
@@ -1674,8 +1677,13 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
command->redirects = (REDIRECT *)NULL;
#if 0
/* TAG: bash-5.3 kre 10/24/2022 */
#if defined (PROCESS_SUBSTITUTION) && defined (JOB_CONTROL)
if (user_subshell && command->type == cm_subshell)
procsub_clear ();
{
procsub_clear ();
last_procsub_child = 0;
}
#endif
#endif
}
+2
View File
@@ -1168,6 +1168,8 @@ expr_streval (tok, e, lvalue)
/* [[[[[ */
#if defined (ARRAY_VARS)
aflag = tflag; /* use a different variable for now */
if (shell_compatibility_level > 51)
aflag |= AV_ATSTARKEYS;
v = (e == ']') ? array_variable_part (tok, tflag, (char **)0, (int *)0) : find_variable (tok);
#else
v = find_variable (tok);
+13 -1
View File
@@ -463,6 +463,11 @@ add_character:
{
rl_stuff_char (cxt->lastc);
rl_execute_next (cxt->prevc);
/* We're going to read the last two characters again. */
_rl_del_executing_keyseq ();
_rl_del_executing_keyseq ();
/* XXX - do we insert everything in cxt->pmb? */
return (0);
}
@@ -477,6 +482,8 @@ add_character:
/* Make lastc be the next character read */
/* XXX - do we insert everything in cxt->mb? */
rl_execute_next (cxt->lastc);
_rl_del_executing_keyseq ();
/* Dispatch on the previous character (insert into search string) */
cxt->lastc = cxt->prevc;
#if defined (HANDLE_MULTIBYTE)
@@ -524,7 +531,10 @@ add_character:
settable keyboard timeout value, this could alternatively
use _rl_input_queued(100000) */
if (cxt->lastc == ESC && (_rl_pushed_input_available () || _rl_input_available ()))
rl_execute_next (ESC);
{
rl_execute_next (ESC);
_rl_del_executing_keyseq ();
}
return (0);
}
@@ -536,6 +546,7 @@ add_character:
/* This sets rl_pending_input to LASTC; it will be picked up the next
time rl_read_key is called. */
rl_execute_next (cxt->lastc);
_rl_del_executing_keyseq ();
return (0);
}
}
@@ -546,6 +557,7 @@ add_character:
/* This sets rl_pending_input to LASTC; it will be picked up the next
time rl_read_key is called. */
rl_execute_next (cxt->lastc);
_rl_del_executing_keyseq ();
return (0);
}
+1
View File
@@ -235,6 +235,7 @@ rl_digit_argument (int ignore, int key)
else
{
rl_execute_next (key);
_rl_del_executing_keyseq ();
return (rl_digit_loop ());
}
}
+5
View File
@@ -566,6 +566,7 @@ readline_internal_charloop (void)
{
static int lastc, eof_found;
int c, code, lk, r;
static procenv_t olevel;
lastc = EOF;
@@ -576,6 +577,9 @@ readline_internal_charloop (void)
#endif
lk = _rl_last_command_was_kill;
/* Save and restore _rl_top_level even though most of the time it
doesn't matter. */
memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t));
#if defined (HAVE_POSIX_SIGSETJMP)
code = sigsetjmp (_rl_top_level, 0);
#else
@@ -586,6 +590,7 @@ readline_internal_charloop (void)
{
(*rl_redisplay_function) ();
_rl_want_redisplay = 0;
memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t));
/* If we longjmped because of a timeout, handle it here. */
if (RL_ISSTATE (RL_STATE_TIMEOUT))
+1 -1
View File
@@ -1,2 +1,2 @@
# Set of available languages.
en@quot en@boldquot af bg ca cs da de el eo es et fi fr ga gl hr hu id it ja ka ko lt nb nl pl pt pt_BR ro ru sk sl sr sv tr uk vi zh_CN zh_TW
en@quot en@boldquot af bg ca cs da de el eo es et fi fr ga gl hr hu id it ja ka ko lt nb nl pl pt pt_BR ro ru sk sl sq sr sv tr uk vi zh_CN zh_TW
BIN
View File
Binary file not shown.
+4143
View File
File diff suppressed because it is too large Load Diff