commit bash-20200228 snapshot

This commit is contained in:
Chet Ramey
2020-03-02 10:24:36 -05:00
parent 0df4ddca3f
commit 47c7369e84
14 changed files with 130 additions and 101 deletions
+14
View File
@@ -7490,3 +7490,17 @@ subst.c
- string_var_assignment: if we have an unset variable with attributes,
return a declare command that just sets the attributes. Feature request
from Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com>
2/24
----
locale.c
- mblen: don't try to use unless HANDLE_MULITBYTE is defined. From
https://savannah.gnu.org/support/?110200
- set_default_locale: if HAVE_SETLOCALE isn't defined, set the default
locale to "C"
2/25
----
general.c
- interrupt_immediately: remove all references to this that are
already commented out
+3 -3
View File
@@ -86,9 +86,9 @@ extern int errno;
#include "bashgetopt.h"
#include "common.h"
static int query_bindings __P((char *));
static int unbind_command __P((char *));
static int unbind_keyseq __P((char *));
static int query_bindings PARAMS((char *));
static int unbind_command PARAMS((char *));
static int unbind_keyseq PARAMS((char *));
#define BIND_RETURN(x) do { return_code = x; goto bind_exit; } while (0)
+11
View File
@@ -78,6 +78,7 @@ $END
#include "../shell.h"
#include "../execute_cmd.h"
#include "../jobs.h"
#include "../trap.h"
#include "common.h"
#include "bashgetopt.h"
@@ -275,6 +276,16 @@ wait_builtin (list)
pstat.status = 127;
status = EXECUTION_FAILURE;
}
/* Don't waste time with a longjmp. */
if (wait_signal_received)
{
last_command_exit_signal = wait_signal_received;
status = 128 + wait_signal_received;
wait_sigint_cleanup ();
WAIT_RETURN (status);
}
list = list->next;
}
+1 -18
View File
@@ -1188,21 +1188,9 @@ bash_tilde_expand (s, assign_p)
const char *s;
int assign_p;
{
int old_immed, old_term, r;
int r;
char *ret;
#if 0
old_immed = interrupt_immediately;
old_term = terminate_immediately;
/* We want to be able to interrupt tilde expansion. Ordinarily, we can just
jump to top_level, but we don't want to run any trap commands in a signal
handler context. We might be able to get away with just checking for
things like SIGINT and SIGQUIT. */
if (any_signals_trapped () < 0)
interrupt_immediately = 1;
terminate_immediately = 1;
#endif
tilde_additional_prefixes = assign_p == 0 ? (char **)0
: (assign_p == 2 ? bash_tilde_prefixes2 : bash_tilde_prefixes);
if (assign_p == 2)
@@ -1211,11 +1199,6 @@ bash_tilde_expand (s, assign_p)
r = (*s == '~') ? unquoted_tilde_word (s) : 1;
ret = r ? tilde_expand (s) : savestring (s);
#if 0
interrupt_immediately = old_immed;
terminate_immediately = old_term;
#endif
QUIT;
return (ret);
+35 -35
View File
@@ -1,6 +1,6 @@
/* input.h -- Structures and unions used for reading input. */
/* Copyright (C) 1993-2018 Free Software Foundation, Inc.
/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -32,8 +32,8 @@ typedef char *CPFunction (); /* no longer used */
typedef char **CPPFunction (); /* no longer used */
#endif /* _FUNCTION_DEF */
typedef int sh_cget_func_t __P((void)); /* sh_ivoidfunc_t */
typedef int sh_cunget_func_t __P((int)); /* sh_intfunc_t */
typedef int sh_cget_func_t PARAMS((void)); /* sh_ivoidfunc_t */
typedef int sh_cunget_func_t PARAMS((int)); /* sh_intfunc_t */
enum stream_type {st_none, st_stdin, st_stream, st_string, st_bstream};
@@ -92,44 +92,44 @@ extern BASH_INPUT bash_input;
/* Functions from parse.y whose use directly or indirectly depends on the
definitions in this file. */
extern void initialize_bash_input __P((void));
extern void init_yy_io __P((sh_cget_func_t *, sh_cunget_func_t *, enum stream_type, const char *, INPUT_STREAM));
extern char *yy_input_name __P((void));
extern void with_input_from_stdin __P((void));
extern void with_input_from_string __P((char *, const char *));
extern void with_input_from_stream __P((FILE *, const char *));
extern void push_stream __P((int));
extern void pop_stream __P((void));
extern int stream_on_stack __P((enum stream_type));
extern char *read_secondary_line __P((int));
extern int find_reserved_word __P((char *));
extern void gather_here_documents __P((void));
extern void execute_variable_command __P((char *, char *));
extern void initialize_bash_input PARAMS((void));
extern void init_yy_io PARAMS((sh_cget_func_t *, sh_cunget_func_t *, enum stream_type, const char *, INPUT_STREAM));
extern char *yy_input_name PARAMS((void));
extern void with_input_from_stdin PARAMS((void));
extern void with_input_from_string PARAMS((char *, const char *));
extern void with_input_from_stream PARAMS((FILE *, const char *));
extern void push_stream PARAMS((int));
extern void pop_stream PARAMS((void));
extern int stream_on_stack PARAMS((enum stream_type));
extern char *read_secondary_line PARAMS((int));
extern int find_reserved_word PARAMS((char *));
extern void gather_here_documents PARAMS((void));
extern void execute_variable_command PARAMS((char *, char *));
extern int *save_token_state __P((void));
extern void restore_token_state __P((int *));
extern int *save_token_state PARAMS((void));
extern void restore_token_state PARAMS((int *));
/* Functions from input.c */
extern int getc_with_restart __P((FILE *));
extern int ungetc_with_restart __P((int, FILE *));
extern int getc_with_restart PARAMS((FILE *));
extern int ungetc_with_restart PARAMS((int, FILE *));
#if defined (BUFFERED_INPUT)
/* Functions from input.c. */
extern int fd_is_bash_input __P((int));
extern int set_bash_input_fd __P((int));
extern int save_bash_input __P((int, int));
extern int check_bash_input __P((int));
extern int duplicate_buffered_stream __P((int, int));
extern BUFFERED_STREAM *fd_to_buffered_stream __P((int));
extern BUFFERED_STREAM *set_buffered_stream __P((int, BUFFERED_STREAM *));
extern BUFFERED_STREAM *open_buffered_stream __P((char *));
extern void free_buffered_stream __P((BUFFERED_STREAM *));
extern int close_buffered_stream __P((BUFFERED_STREAM *));
extern int close_buffered_fd __P((int));
extern int sync_buffered_stream __P((int));
extern int buffered_getchar __P((void));
extern int buffered_ungetchar __P((int));
extern void with_input_from_buffered_stream __P((int, char *));
extern int fd_is_bash_input PARAMS((int));
extern int set_bash_input_fd PARAMS((int));
extern int save_bash_input PARAMS((int, int));
extern int check_bash_input PARAMS((int));
extern int duplicate_buffered_stream PARAMS((int, int));
extern BUFFERED_STREAM *fd_to_buffered_stream PARAMS((int));
extern BUFFERED_STREAM *set_buffered_stream PARAMS((int, BUFFERED_STREAM *));
extern BUFFERED_STREAM *open_buffered_stream PARAMS((char *));
extern void free_buffered_stream PARAMS((BUFFERED_STREAM *));
extern int close_buffered_stream PARAMS((BUFFERED_STREAM *));
extern int close_buffered_fd PARAMS((int));
extern int sync_buffered_stream PARAMS((int));
extern int buffered_getchar PARAMS((void));
extern int buffered_ungetchar PARAMS((int));
extern void with_input_from_buffered_stream PARAMS((int, char *));
#endif /* BUFFERED_INPUT */
#endif /* _INPUT_H_ */
+16 -33
View File
@@ -3,7 +3,7 @@
/* This file works with both POSIX and BSD systems. It implements job
control. */
/* Copyright (C) 1989-2019 Free Software Foundation, Inc.
/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -2628,6 +2628,9 @@ wait_for_single_pid (pid, flags)
bgp_delete (pid);
}
/* Check for a trapped signal interrupting the wait builtin and jump out */
CHECK_WAIT_INTR;
return r;
}
@@ -2706,7 +2709,8 @@ static SigHandler *old_sigint_handler = INVALID_SIGNAL_HANDLER;
static int wait_sigint_received;
static int child_caught_sigint;
static int waiting_for_child;
int waiting_for_child;
/* Clean up state after longjmp to wait_intr_buf */
void
@@ -2964,39 +2968,20 @@ wait_for (pid)
if (pid == ANY_PID || PRUNNING(child) || (job != NO_JOB && RUNNING (job)))
{
#if defined (WAITPID_BROKEN) /* SCOv4 */
sigset_t suspend_set;
sigemptyset (&suspend_set);
sigsuspend (&suspend_set);
#else /* !WAITPID_BROKEN */
# if defined (MUST_UNBLOCK_CHLD)
struct sigaction act, oact;
sigset_t nullset, chldset;
int old_waiting;
queue_sigchld = 1;
sigemptyset (&nullset);
sigemptyset (&chldset);
sigprocmask (SIG_SETMASK, &nullset, &chldset);
act.sa_handler = SIG_DFL;
sigemptyset (&act.sa_mask);
sigemptyset (&oact.sa_mask);
act.sa_flags = 0;
# if defined (SA_RESTART)
act.sa_flags |= SA_RESTART;
# endif
sigaction (SIGCHLD, &act, &oact);
# endif /* MUST_UNBLOCK_CHLD */
queue_sigchld = 1;
waiting_for_child++;
old_waiting = waiting_for_child;
waiting_for_child = 1;
/* XXX - probably not strictly necessary but we want to catch
everything that happened before we switch the behavior of
trap_handler to longjmp on a trapped signal (waiting_for_child) */
CHECK_WAIT_INTR;
r = waitchld (pid, 1); /* XXX */
waiting_for_child--;
waiting_for_child = old_waiting;
#if 0
itrace("wait_for: blocking wait for %d returns %d child = %p", (int)pid, r, child);
#endif
# if defined (MUST_UNBLOCK_CHLD)
sigaction (SIGCHLD, &oact, (struct sigaction *)NULL);
sigprocmask (SIG_SETMASK, &chldset, (sigset_t *)NULL);
# endif
queue_sigchld = 0;
if (r == -1 && errno == ECHILD && this_shell_builtin == wait_builtin)
{
@@ -3030,7 +3015,6 @@ itrace("wait_for: blocking wait for %d returns %d child = %p", (int)pid, r, chil
break;
}
}
#endif /* WAITPID_BROKEN */
}
/* If the shell is interactive, and job control is disabled, see
@@ -3249,6 +3233,8 @@ wait_for_job (job, flags, ps)
if (r == -1 && errno == ECHILD)
mark_all_jobs_as_dead ();
CHECK_WAIT_INTR;
if ((flags & JWAIT_FORCE) == 0)
break;
@@ -4222,9 +4208,6 @@ run_sigchld_trap (nchild)
jobs_list_frozen = 1;
for (i = 0; i < nchild; i++)
{
#if 0
interrupt_immediately = 1;
#endif
parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE);
}
+1 -1
View File
@@ -599,7 +599,7 @@ The number of entries currently stored in the history list.
The maximum number of history entries. This must be changed using
\fBstifle_history()\fP.
.Vb int history_wite_timestamps
.Vb int history_write_timestamps
If non-zero, timestamps are written to the history file, so they can be
preserved between sessions. The default value is 0, meaning that
timestamps are not saved.
+1
View File
@@ -46,6 +46,7 @@ extern void exit();
extern HIST_ENTRY **history_list ();
int
main ()
{
char *temp, *prompt;
+29 -5
View File
@@ -1,6 +1,6 @@
/* locale.c - Miscellaneous internationalization functions. */
/* Copyright (C) 1996-2009,2012,2016 Free Software Foundation, Inc.
/* Copyright (C) 1996-2009,2012,2016,2020 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -45,7 +45,7 @@ extern int errno;
int locale_utf8locale;
int locale_mb_cur_max; /* value of MB_CUR_MAX for current locale (LC_CTYPE) */
int locale_shiftstates;
int locale_shiftstates = 0;
extern int dump_translatable_strings, dump_po_strings;
@@ -66,10 +66,10 @@ static char *lang;
/* Called to reset all of the locale variables to their appropriate values
if (and only if) LC_ALL has not been assigned a value. */
static int reset_locale_vars __P((void));
static int reset_locale_vars PARAMS((void));
static void locale_setblanks __P((void));
static int locale_isutf8 __P((char *));
static void locale_setblanks PARAMS((void));
static int locale_isutf8 PARAMS((char *));
/* Set the value of default_locale and make the current locale the
system default locale. This should be called very early in main(). */
@@ -80,13 +80,19 @@ set_default_locale ()
default_locale = setlocale (LC_ALL, "");
if (default_locale)
default_locale = savestring (default_locale);
#else
default_locale = savestring ("C");
#endif /* HAVE_SETLOCALE */
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
locale_mb_cur_max = MB_CUR_MAX;
locale_utf8locale = locale_isutf8 (default_locale);
#if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
#else
local_shiftstates = 0;
#endif
}
/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC and
@@ -107,7 +113,13 @@ set_default_locale_vars ()
locale_setblanks ();
locale_mb_cur_max = MB_CUR_MAX;
locale_utf8locale = locale_isutf8 (lc_all);
# if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
# else
local_shiftstates = 0;
# endif
u32reset ();
}
# endif
@@ -211,7 +223,11 @@ set_locale_var (var, value)
/* if LC_ALL == "", reset_locale_vars has already called this */
if (*lc_all && x)
locale_utf8locale = locale_isutf8 (lc_all);
# if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
# else
local_shiftstates = 0;
# endif
u32reset ();
return r;
#else
@@ -231,7 +247,11 @@ set_locale_var (var, value)
/* if setlocale() returns NULL, the locale is not changed */
if (x)
locale_utf8locale = locale_isutf8 (x);
#if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
#else
local_shiftstates = 0;
#endif
u32reset ();
}
# endif
@@ -368,7 +388,11 @@ reset_locale_vars ()
locale_mb_cur_max = MB_CUR_MAX;
if (x)
locale_utf8locale = locale_isutf8 (x);
# if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
# else
local_shiftstates = 0;
# endif
u32reset ();
#endif
return 1;
+14 -1
View File
@@ -79,7 +79,8 @@ extern void set_original_signal __P((int, SigHandler *));
volatile pid_t last_made_pid = NO_PID;
volatile pid_t last_asynchronous_pid = NO_PID;
static int queue_sigchld, waiting_for_child; /* dummy declarations */
static int queue_sigchld; /* dummy declaration */
int waiting_for_child;
/* Call this when you start making children. */
int already_making_children = 0;
@@ -685,6 +686,7 @@ wait_for_single_pid (pid, flags)
siginterrupt (SIGINT, 0);
QUIT;
CHECK_WAIT_INTR;
return (got_pid > 0 ? process_exit_status (status) : -1);
}
@@ -706,15 +708,20 @@ wait_for_background_pids (ps)
siginterrupt (SIGINT, 1);
/* Wait for ECHILD */
waiting_for_child = 1;
while ((got_pid = WAITPID (-1, &status, 0)) != -1)
{
waiting_for_child = 0;
set_pid_status (got_pid, status);
if (ps)
{
ps->pid = got_pid;
ps->status = process_exit_status (status);
}
waiting_for_child = 1;
CHECK_WAIT_INTR;
}
waiting_for_child = 0;
if (errno != EINTR && errno != ECHILD)
{
@@ -724,6 +731,7 @@ wait_for_background_pids (ps)
siginterrupt (SIGINT, 0);
QUIT;
CHECK_WAIT_INTR;
mark_dead_jobs_as_notified (1);
cleanup_dead_jobs ();
@@ -828,8 +836,11 @@ wait_for (pid)
if (interactive_shell == 0)
old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
waiting_for_child = 1;
CHECK_WAIT_INTR;
while ((got_pid = WAITPID (-1, &status, 0)) != pid) /* XXX was pid now -1 */
{
waiting_for_child = 0;
CHECK_TERMSIG;
CHECK_WAIT_INTR;
if (got_pid < 0 && errno == ECHILD)
@@ -845,7 +856,9 @@ wait_for (pid)
programming_error ("wait_for(%ld): %s", (long)pid, strerror(errno));
else if (got_pid > 0)
set_pid_status (got_pid, status);
waiting_for_child = 1;
}
waiting_for_child = 0;
if (got_pid > 0)
set_pid_status (got_pid, status);
+1 -1
View File
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
#define PATCHLEVEL 11
#define PATCHLEVEL 16
#endif /* _PATCHLEVEL_H_ */
+1 -2
View File
@@ -670,8 +670,7 @@ sigint_sighandler (sig)
if (interrupt_immediately)
{
interrupt_immediately = 0;
last_command_exit_value = 128 + sig;
set_pipestatus_from_exit (last_command_exit_value);
set_exit_status (128 + sig);
throw_to_top_level ();
}
#if defined (READLINE)
+1 -1
View File
@@ -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
PATH=$PATH:$BUILD_DIR
+2 -1
View File
@@ -90,6 +90,7 @@ static void trap_if_untrapped (int, char *);
extern procenv_t alrmbuf;
extern volatile int from_return_trap;
extern int waiting_for_child;
extern WORD_LIST *subst_assign_varlist;
@@ -487,7 +488,7 @@ trap_handler (sig)
if (this_shell_builtin && (this_shell_builtin == wait_builtin))
{
wait_signal_received = sig;
if (/* interrupt_immediately && */wait_intr_flag)
if (waiting_for_child && wait_intr_flag)
sh_longjmp (wait_intr_buf, 1);
}