mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 15:43:18 +02:00
fix for EOF while reading a quoted string; allow window size updates during trap commands or `bind -x' commands
This commit is contained in:
@@ -5418,3 +5418,22 @@ parse.y
|
||||
doc/{bash.1,bashref.texi}
|
||||
- update aliases description based on a bug-bash discussion
|
||||
- update description of word splitting behavior when IFS is unset
|
||||
|
||||
builtins/evalfile.c
|
||||
- _evalfile: if reading the entire file doesn't return the same
|
||||
number of bytes as requested (the file size), treat this as a read
|
||||
error
|
||||
|
||||
2/21
|
||||
----
|
||||
parse.y
|
||||
- yylex: if read_token returns < 0, return YYEOF if EOF_Reached = 1.
|
||||
Don't return yacc_EOF because that allows commands to be executed.
|
||||
- grammar: add a production to handle YYEOF, treating it the same as
|
||||
yacc_EOF. Based on a report from
|
||||
Eduardo A. Bustamante López <dualbus@gmail.com>
|
||||
|
||||
jobs.c
|
||||
- wait_for: if we're checking for window size changes, allow checks
|
||||
during trap commands while readline is active or `bind -x' command
|
||||
execution. Fix from Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
+3
-1
@@ -151,7 +151,7 @@ file_error_and_exit:
|
||||
(*errfunc) (_("%s: file is too large"), filename);
|
||||
close (fd);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (S_ISREG (finfo.st_mode) && file_size <= SSIZE_MAX)
|
||||
{
|
||||
@@ -159,6 +159,8 @@ file_error_and_exit:
|
||||
nr = read (fd, string, file_size);
|
||||
if (nr >= 0)
|
||||
string[nr] = '\0';
|
||||
if (nr != file_size)
|
||||
nr = -1; /* XXX - didn't get the whole file */
|
||||
}
|
||||
else
|
||||
nr = zmapfd (fd, &string, 0);
|
||||
|
||||
@@ -3058,8 +3058,16 @@ if (job == NO_JOB)
|
||||
else
|
||||
#if defined (READLINE)
|
||||
/* We don't want to do this if we are running a process during
|
||||
programmable completion or a command bound to `bind -x'. */
|
||||
if (RL_ISSTATE (RL_STATE_COMPLETING|RL_STATE_DISPATCHING|RL_STATE_TERMPREPPED) == 0)
|
||||
programmable completion, but we do want to handle window size
|
||||
changes for traps while readline is active or a command bound
|
||||
to `bind -x'. */
|
||||
if (RL_ISSTATE (RL_STATE_COMPLETING) == 0)
|
||||
if (RL_ISSTATE(RL_STATE_DISPATCHING|RL_STATE_TERMPREPPED) != 0)
|
||||
{
|
||||
if (check_window_size)
|
||||
get_new_window_size (0, (int *)0, (int *)0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
get_tty_state ();
|
||||
|
||||
|
||||
@@ -466,6 +466,21 @@ inputunit: simple_list simple_list_terminator
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| error YYEOF
|
||||
{
|
||||
global_command = (COMMAND *)NULL;
|
||||
if (last_command_exit_value == 0)
|
||||
last_command_exit_value = EX_BADUSAGE; /* force error return */
|
||||
if (interactive && parse_and_execute_level == 0)
|
||||
{
|
||||
handle_eof_input_unit ();
|
||||
YYACCEPT;
|
||||
}
|
||||
else
|
||||
{
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| yacc_EOF
|
||||
{
|
||||
/* Case of EOF seen by itself. Do ignoreeof or
|
||||
@@ -2459,6 +2474,11 @@ shell_getc (int remove_quoted_newline)
|
||||
/* If we want to make read errors cancel execution of any partial
|
||||
line, take out the checks for i == 0 above and set i = 0 if
|
||||
shell_input_line_terminator == READERR. */
|
||||
/* XXX TAG: bash-5.3 austingroup interp 1629 */
|
||||
#if defined (FATAL_READERROR)
|
||||
if (shell_input_line_terminator == READERR)
|
||||
i = 0; /* no-op for now */
|
||||
#endif
|
||||
|
||||
shell_input_line[i] = '\0';
|
||||
break;
|
||||
@@ -2923,9 +2943,9 @@ yylex (void)
|
||||
|
||||
if (current_token < 0)
|
||||
#if defined (YYERRCODE) && !defined (YYUNDEF)
|
||||
current_token = YYERRCODE;
|
||||
current_token = EOF_Reached ? YYEOF : YYERRCODE;
|
||||
#else
|
||||
current_token = YYUNDEF;
|
||||
current_token = EOF_Reached ? YYEOF : YYUNDEF;
|
||||
#endif
|
||||
|
||||
return (current_token);
|
||||
|
||||
Reference in New Issue
Block a user