mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 18:22:25 +02:00
commit bash-20151218 snapshot
This commit is contained in:
@@ -10153,3 +10153,26 @@ lib/readline/display.c
|
|||||||
- update_line: update code that attempts to compute where we are in
|
- update_line: update code that attempts to compute where we are in
|
||||||
the new line buffer. Fixes `vt100' bug reported to bug-readline by
|
the new line buffer. Fixes `vt100' bug reported to bug-readline by
|
||||||
Per Bothner <per@bothner.com>
|
Per Bothner <per@bothner.com>
|
||||||
|
|
||||||
|
12/18
|
||||||
|
-----
|
||||||
|
execute_cmd.c
|
||||||
|
- execute_function: unwind-protect and restore BASH_ARGC and BASH_ARGV
|
||||||
|
- restore_funcarray_state: now global
|
||||||
|
|
||||||
|
execute_cmd.h
|
||||||
|
- make func_array_state type global, add extern function declaration
|
||||||
|
for restore_funcarray_state
|
||||||
|
|
||||||
|
builtins/evalfile.c
|
||||||
|
- _evalfile: use restore_funcarray_state and pop_args as unwind-protects
|
||||||
|
to restore BASH_{SOURCE,LINENO,ARGC,ARGV} and FUNCNAME on interrupts.
|
||||||
|
Fixes bug reported back on 11/10 by Grisha Levit
|
||||||
|
<grishalevit@gmail.com>
|
||||||
|
|
||||||
|
12/20
|
||||||
|
-----
|
||||||
|
lib/readline/isearch.c
|
||||||
|
- _rl_isearch_dispatch: after removing the only character from the
|
||||||
|
search string with DEL, leaving the search string empty, don't match
|
||||||
|
the previous line if we didn't have a match before
|
||||||
|
|||||||
+26
-20
@@ -94,6 +94,7 @@ _evalfile (filename, flags)
|
|||||||
#if defined (ARRAY_VARS)
|
#if defined (ARRAY_VARS)
|
||||||
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
|
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
|
||||||
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
|
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
|
||||||
|
struct func_array_state *fa;
|
||||||
# if defined (DEBUGGER)
|
# if defined (DEBUGGER)
|
||||||
SHELL_VAR *bash_argv_v, *bash_argc_v;
|
SHELL_VAR *bash_argv_v, *bash_argc_v;
|
||||||
ARRAY *bash_argv_a, *bash_argc_a;
|
ARRAY *bash_argv_a, *bash_argc_a;
|
||||||
@@ -243,6 +244,17 @@ file_error_and_exit:
|
|||||||
array_push (bash_lineno_a, t);
|
array_push (bash_lineno_a, t);
|
||||||
free (t);
|
free (t);
|
||||||
array_push (funcname_a, "source"); /* not exactly right */
|
array_push (funcname_a, "source"); /* not exactly right */
|
||||||
|
|
||||||
|
fa = (struct func_array_state *)xmalloc (sizeof (struct func_array_state));
|
||||||
|
fa->source_a = bash_source_a;
|
||||||
|
fa->source_v = bash_source_v;
|
||||||
|
fa->lineno_a = bash_lineno_a;
|
||||||
|
fa->lineno_v = bash_lineno_v;
|
||||||
|
fa->funcname_a = funcname_a;
|
||||||
|
fa->funcname_v = funcname_v;
|
||||||
|
if (flags & FEVAL_UNWINDPROT)
|
||||||
|
add_unwind_protect (restore_funcarray_state, fa);
|
||||||
|
|
||||||
# if defined (DEBUGGER)
|
# if defined (DEBUGGER)
|
||||||
/* Have to figure out a better way to do this when `source' is supplied
|
/* Have to figure out a better way to do this when `source' is supplied
|
||||||
arguments */
|
arguments */
|
||||||
@@ -251,6 +263,8 @@ file_error_and_exit:
|
|||||||
array_push (bash_argv_a, (char *)filename);
|
array_push (bash_argv_a, (char *)filename);
|
||||||
tt[0] = '1'; tt[1] = '\0';
|
tt[0] = '1'; tt[1] = '\0';
|
||||||
array_push (bash_argc_a, tt);
|
array_push (bash_argc_a, tt);
|
||||||
|
if (flags & FEVAL_UNWINDPROT)
|
||||||
|
add_unwind_protect (pop_args, 0);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -280,31 +294,23 @@ file_error_and_exit:
|
|||||||
{
|
{
|
||||||
if (flags & FEVAL_NONINT)
|
if (flags & FEVAL_NONINT)
|
||||||
interactive = old_interactive;
|
interactive = old_interactive;
|
||||||
|
#if defined (ARRAY_VARS)
|
||||||
|
restore_funcarray_state (fa);
|
||||||
|
# if defined (DEBUGGER)
|
||||||
|
if ((flags & FEVAL_NOPUSHARGS) == 0)
|
||||||
|
{
|
||||||
|
/* Don't need to call pop_args here until we do something better
|
||||||
|
when source is passed arguments (see above). */
|
||||||
|
array_pop (bash_argc_a);
|
||||||
|
array_pop (bash_argv_a);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
return_catch_flag--;
|
return_catch_flag--;
|
||||||
sourcelevel--;
|
sourcelevel--;
|
||||||
COPY_PROCENV (old_return_catch, return_catch);
|
COPY_PROCENV (old_return_catch, return_catch);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (ARRAY_VARS)
|
|
||||||
/* These two variables cannot be unset, and cannot be affected by the
|
|
||||||
sourced file. */
|
|
||||||
array_pop (bash_source_a);
|
|
||||||
array_pop (bash_lineno_a);
|
|
||||||
|
|
||||||
/* FUNCNAME can be unset, and so can potentially be changed by the
|
|
||||||
sourced file. */
|
|
||||||
GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a);
|
|
||||||
if (nfv == funcname_v)
|
|
||||||
array_pop (funcname_a);
|
|
||||||
# if defined (DEBUGGER)
|
|
||||||
if ((flags & FEVAL_NOPUSHARGS) == 0)
|
|
||||||
{
|
|
||||||
array_pop (bash_argc_a);
|
|
||||||
array_pop (bash_argv_a);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If we end up with EOF after sourcing a file, which can happen when the file
|
/* If we end up with EOF after sourcing a file, which can happen when the file
|
||||||
doesn't end with a newline, pretend that it did. */
|
doesn't end with a newline, pretend that it did. */
|
||||||
if (current_token == yacc_EOF)
|
if (current_token == yacc_EOF)
|
||||||
|
|||||||
+12
-19
@@ -105,18 +105,6 @@ extern int errno;
|
|||||||
# include <mbstr.h> /* mbschr */
|
# include <mbstr.h> /* mbschr */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (ARRAY_VARS)
|
|
||||||
struct func_array_state
|
|
||||||
{
|
|
||||||
ARRAY *funcname_a;
|
|
||||||
SHELL_VAR *funcname_v;
|
|
||||||
ARRAY *source_a;
|
|
||||||
SHELL_VAR *source_v;
|
|
||||||
ARRAY *lineno_a;
|
|
||||||
SHELL_VAR *lineno_v;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int dollar_dollar_pid;
|
extern int dollar_dollar_pid;
|
||||||
extern int posixly_correct;
|
extern int posixly_correct;
|
||||||
extern int expand_aliases;
|
extern int expand_aliases;
|
||||||
@@ -4504,7 +4492,7 @@ maybe_restore_getopt_state (gs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined (ARRAY_VARS)
|
#if defined (ARRAY_VARS)
|
||||||
static void
|
void
|
||||||
restore_funcarray_state (fa)
|
restore_funcarray_state (fa)
|
||||||
struct func_array_state *fa;
|
struct func_array_state *fa;
|
||||||
{
|
{
|
||||||
@@ -4674,7 +4662,11 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
|
|||||||
|
|
||||||
/* Update BASH_ARGV and BASH_ARGC */
|
/* Update BASH_ARGV and BASH_ARGC */
|
||||||
if (debugging_mode)
|
if (debugging_mode)
|
||||||
push_args (words->next);
|
{
|
||||||
|
push_args (words->next);
|
||||||
|
if (subshell == 0)
|
||||||
|
add_unwind_protect (pop_args, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Number of the line on which the function body starts. */
|
/* Number of the line on which the function body starts. */
|
||||||
line_number = function_line_number = tc->line;
|
line_number = function_line_number = tc->line;
|
||||||
@@ -4734,10 +4726,6 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
|
|||||||
showing_function_line = 0;
|
showing_function_line = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore BASH_ARGC and BASH_ARGV */
|
|
||||||
if (debugging_mode)
|
|
||||||
pop_args ();
|
|
||||||
|
|
||||||
/* If we have a local copy of OPTIND, note it in the saved getopts state. */
|
/* If we have a local copy of OPTIND, note it in the saved getopts state. */
|
||||||
gv = find_variable ("OPTIND");
|
gv = find_variable ("OPTIND");
|
||||||
if (gv && gv->context == variable_context)
|
if (gv && gv->context == variable_context)
|
||||||
@@ -4747,7 +4735,12 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
|
|||||||
run_unwind_frame ("function_calling");
|
run_unwind_frame ("function_calling");
|
||||||
#if defined (ARRAY_VARS)
|
#if defined (ARRAY_VARS)
|
||||||
else
|
else
|
||||||
restore_funcarray_state (fa);
|
{
|
||||||
|
restore_funcarray_state (fa);
|
||||||
|
/* Restore BASH_ARGC and BASH_ARGV */
|
||||||
|
if (debugging_mode)
|
||||||
|
pop_args ();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (variable_context == 0 || this_shell_function == 0)
|
if (variable_context == 0 || this_shell_function == 0)
|
||||||
|
|||||||
+15
-1
@@ -1,6 +1,6 @@
|
|||||||
/* execute_cmd.h - functions from execute_cmd.c. */
|
/* execute_cmd.h - functions from execute_cmd.c. */
|
||||||
|
|
||||||
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
|
/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bash, the Bourne Again SHell.
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
@@ -23,6 +23,18 @@
|
|||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
|
|
||||||
|
#if defined (ARRAY_VARS)
|
||||||
|
struct func_array_state
|
||||||
|
{
|
||||||
|
ARRAY *funcname_a;
|
||||||
|
SHELL_VAR *funcname_v;
|
||||||
|
ARRAY *source_a;
|
||||||
|
SHELL_VAR *source_v;
|
||||||
|
ARRAY *lineno_a;
|
||||||
|
SHELL_VAR *lineno_v;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
extern struct fd_bitmap *new_fd_bitmap __P((int));
|
extern struct fd_bitmap *new_fd_bitmap __P((int));
|
||||||
extern void dispose_fd_bitmap __P((struct fd_bitmap *));
|
extern void dispose_fd_bitmap __P((struct fd_bitmap *));
|
||||||
extern void close_fd_bitmap __P((struct fd_bitmap *));
|
extern void close_fd_bitmap __P((struct fd_bitmap *));
|
||||||
@@ -65,4 +77,6 @@ extern void coproc_unsetvars __P((struct coproc *));
|
|||||||
extern void close_all_files __P((void));
|
extern void close_all_files __P((void));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void restore_funcarray_state __P((struct func_array_state *));
|
||||||
|
|
||||||
#endif /* _EXECUTE_CMD_H_ */
|
#endif /* _EXECUTE_CMD_H_ */
|
||||||
|
|||||||
@@ -3565,7 +3565,6 @@ itrace("waitchld: waitpid returns %d block = %d children_exited = %d", pid, bloc
|
|||||||
{
|
{
|
||||||
if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin)
|
if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin)
|
||||||
{
|
{
|
||||||
itrace("waitchld: this_shell_builtin == wait_builtin got %d children wait_intr_flag = %d", children_exited, wait_intr_flag);
|
|
||||||
interrupt_immediately = 0;
|
interrupt_immediately = 0;
|
||||||
/* This was trap_handler (SIGCHLD) but that can lose traps if
|
/* This was trap_handler (SIGCHLD) but that can lose traps if
|
||||||
children_exited > 1 */
|
children_exited > 1 */
|
||||||
|
|||||||
+11
-1
@@ -560,8 +560,12 @@ add_character:
|
|||||||
if (wstart >= 0)
|
if (wstart >= 0)
|
||||||
cxt->search_string[cxt->search_string_index = wstart] = '\0';
|
cxt->search_string[cxt->search_string_index = wstart] = '\0';
|
||||||
else
|
else
|
||||||
rl_ding ();
|
cxt->search_string[cxt->search_string_index = 0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cxt->search_string_index == 0)
|
||||||
|
rl_ding ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -4: /* C-G, abort */
|
case -4: /* C-G, abort */
|
||||||
@@ -654,6 +658,12 @@ add_character:
|
|||||||
|
|
||||||
for (cxt->sflags &= ~(SF_FOUND|SF_FAILED);; )
|
for (cxt->sflags &= ~(SF_FOUND|SF_FAILED);; )
|
||||||
{
|
{
|
||||||
|
if (cxt->search_string_index == 0)
|
||||||
|
{
|
||||||
|
cxt->sflags |= SF_FAILED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
limit = cxt->sline_len - cxt->search_string_index + 1;
|
limit = cxt->sline_len - cxt->search_string_index + 1;
|
||||||
|
|
||||||
/* Search the current line. */
|
/* Search the current line. */
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||||
THIS_SH=$BUILD_DIR/bash
|
THIS_SH=$BUILD_DIR/bash
|
||||||
PATH=$PATH:$BUILD_DIR
|
PATH=$PATH:$BUILD_DIR
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user