commit bash-20190426 snapshot

This commit is contained in:
Chet Ramey
2019-04-29 08:48:08 -04:00
parent 9128f93291
commit 42a9b8a197
6 changed files with 44 additions and 2280 deletions
+22
View File
@@ -5843,3 +5843,25 @@ lib/readline/input.c
not have had it ignored. Run the signal handler and set the signal
hook in case the application wants to handle it. Report from
Robert Elz <kre@bmunnari.oz.au>
4/26
----
parse.y
- parser_will_prompt: check and return true if we have consumed the
entire readline line buffer and will have to go back to readline for
more input, printing a prompt as a consequence
eval.c
- parse_command: if parser_will_prompt() returns 0, indicating that we
still have unconsumed input in the readline line buffer, don't
execute PROMPT_COMMAND. TENTATIVE fix prompted by report from
Matteo Landi <matteo@matteolandi.net>
builtins/read.def
- set_eol_delim: save the old values before changing the bindings for
RETURN and the delimiter character, in case the delimiter is RETURN.
Fixes bug report from Stephane Chazelas <stephane.chazelas@gmail.com>
- read_builtin: if the delimiter is '\0' and we are using readline,
don't terminate the buffer and go back to read another character;
allow the NULL to pass through and terminate the read.
Fixes bug report from Stephane Chazelas <stephane.chazelas@gmail.com>
+7 -4
View File
@@ -569,7 +569,8 @@ read_builtin (list)
#if defined (READLINE)
if (edit)
{
if (rlbuf && rlbuf[rlind] == '\0')
/* If we have a null delimiter, don't treat NULL as ending the line */
if (rlbuf && rlbuf[rlind] == '\0' && delim != '\0')
{
free (rlbuf);
rlbuf = (char *)0;
@@ -1148,15 +1149,17 @@ set_eol_delim (c)
initialize_readline ();
cmap = rl_get_keymap ();
/* Change newline to self-insert */
/* Save the old delimiter char binding */
old_newline_ctype = cmap[RETURN].type;
old_newline_func = cmap[RETURN].function;
old_delim_ctype = cmap[c].type;
old_delim_func = cmap[c].function;
/* Change newline to self-insert */
cmap[RETURN].type = ISFUNC;
cmap[RETURN].function = rl_insert;
/* Bind the delimiter character to accept-line. */
old_delim_ctype = cmap[c].type;
old_delim_func = cmap[c].function;
cmap[c].type = ISFUNC;
cmap[c].function = rl_newline;
+4 -1
View File
@@ -293,7 +293,10 @@ parse_command ()
actually printed. */
if (interactive && bash_input.type != st_string && parser_expanding_alias() == 0)
{
execute_prompt_command ();
#if defined (READLINE)
if (no_line_editing || (bash_input.type == st_stdin && parser_will_prompt ()))
#endif
execute_prompt_command ();
if (running_under_emacs == 2)
send_pwd_to_eterm (); /* Yuck */
+1
View File
@@ -112,6 +112,7 @@ extern void reset_parser __P((void));
extern void reset_readahead_token __P((void));
extern WORD_LIST *parse_string_to_word_list __P((char *, int, const char *));
extern int parser_will_prompt __P((void));
extern int parser_in_command_position __P((void));
extern void free_pushed_string_input __P((void));
File diff suppressed because it is too large Load Diff
+10 -2
View File
@@ -1479,7 +1479,6 @@ yy_readline_get ()
old_sigint = IMPOSSIBLE_TRAP_HANDLER;
if (signal_is_ignored (SIGINT) == 0)
{
/* interrupt_immediately++; */
old_sigint = (SigHandler *)set_signal_handler (SIGINT, sigint_sighandler);
}
@@ -1490,7 +1489,6 @@ yy_readline_get ()
CHECK_TERMSIG;
if (signal_is_ignored (SIGINT) == 0)
{
/* interrupt_immediately--; */
if (old_sigint != IMPOSSIBLE_TRAP_HANDLER)
set_signal_handler (SIGINT, old_sigint);
}
@@ -1546,6 +1544,16 @@ with_input_from_stdin ()
}
}
/* Will we be collecting another input line and printing a prompt? This uses
different conditions than SHOULD_PROMPT(), since readline allows a user to
embed a newline in the middle of the line it collects, which the parser
will interpret as a line break and command delimiter. */
int
parser_will_prompt ()
{
return (current_readline_line == 0 || current_readline_line[current_readline_line_index] == 0);
}
#else /* !READLINE */
void