From: Chet Ramey Date: Mon, 19 Aug 2019 13:14:49 +0000 (-0400) Subject: commit bash-20190816 snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ec948312dfa5626486c9ebb68669b6fa8b7df85;p=thirdparty%2Fbash.git commit bash-20190816 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 5fc3f13da..df23c1698 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -6448,3 +6448,15 @@ subst.c scalar variable without `set -u' in effect) and just call MB_STRLEN on the variable value in that case. From a report from Alkis Georgopoulos + + 8/13 + ---- +execute_cmd.c + - execute_subshell_builtin_or_function: call subshell_exit() instead of + sh_exit() or exit() so the exit trap gets run. Fixes issue reported + in https://savannah.gnu.org/support/?109840 + - replace __P with PARAMS + +lib/readline/colors.c + - _rl_print_color_indicator: eliminate one use of S_ISLNK. + Report and fix from Christian Biesinger diff --git a/doc/bashref.texi b/doc/bashref.texi index 3b667e020..965b758cb 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -1664,7 +1664,7 @@ only be referenced; assignment to them is not allowed. When the expansion is not within double quotes, each positional parameter expands to a separate word. In contexts where it is performed, those words -are subject to further word splitting and pathname expansion. +are subject to further word splitting and filename expansion. When the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by the first character of the @env{IFS} special variable. That is, @code{"$*"} is equivalent @@ -2880,7 +2880,7 @@ A variant of here documents, the format is: The @var{word} undergoes tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal. -Pathname expansion and word splitting are not performed. +Filename expansion and word splitting are not performed. The result is supplied as a single string, with a newline appended, to the command on its diff --git a/execute_cmd.c b/execute_cmd.c index 6c50d0c9a..e2c9baace 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -1,6 +1,6 @@ /* execute_cmd.c -- Execute a COMMAND structure. */ -/* Copyright (C) 1987-2018 Free Software Foundation, Inc. +/* Copyright (C) 1987-2019 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -113,85 +113,85 @@ extern time_t shell_start_time; extern char *glob_argv_flags; #endif -extern int close __P((int)); +extern int close PARAMS((int)); /* Static functions defined and used in this file. */ -static void close_pipes __P((int, int)); -static void do_piping __P((int, int)); -static void bind_lastarg __P((char *)); -static int shell_control_structure __P((enum command_type)); -static void cleanup_redirects __P((REDIRECT *)); +static void close_pipes PARAMS((int, int)); +static void do_piping PARAMS((int, int)); +static void bind_lastarg PARAMS((char *)); +static int shell_control_structure PARAMS((enum command_type)); +static void cleanup_redirects PARAMS((REDIRECT *)); #if defined (JOB_CONTROL) -static int restore_signal_mask __P((sigset_t *)); +static int restore_signal_mask PARAMS((sigset_t *)); #endif -static void async_redirect_stdin __P((void)); +static void async_redirect_stdin PARAMS((void)); -static int builtin_status __P((int)); +static int builtin_status PARAMS((int)); -static int execute_for_command __P((FOR_COM *)); +static int execute_for_command PARAMS((FOR_COM *)); #if defined (SELECT_COMMAND) -static int displen __P((const char *)); -static int print_index_and_element __P((int, int, WORD_LIST *)); -static void indent __P((int, int)); -static void print_select_list __P((WORD_LIST *, int, int, int)); -static char *select_query __P((WORD_LIST *, int, char *, int)); -static int execute_select_command __P((SELECT_COM *)); +static int displen PARAMS((const char *)); +static int print_index_and_element PARAMS((int, int, WORD_LIST *)); +static void indent PARAMS((int, int)); +static void print_select_list PARAMS((WORD_LIST *, int, int, int)); +static char *select_query PARAMS((WORD_LIST *, int, char *, int)); +static int execute_select_command PARAMS((SELECT_COM *)); #endif #if defined (DPAREN_ARITHMETIC) -static int execute_arith_command __P((ARITH_COM *)); +static int execute_arith_command PARAMS((ARITH_COM *)); #endif #if defined (COND_COMMAND) -static int execute_cond_node __P((COND_COM *)); -static int execute_cond_command __P((COND_COM *)); +static int execute_cond_node PARAMS((COND_COM *)); +static int execute_cond_command PARAMS((COND_COM *)); #endif #if defined (COMMAND_TIMING) -static int mkfmt __P((char *, int, int, time_t, int)); -static void print_formatted_time __P((FILE *, char *, +static int mkfmt PARAMS((char *, int, int, time_t, int)); +static void print_formatted_time PARAMS((FILE *, char *, time_t, int, time_t, int, time_t, int, int)); -static int time_command __P((COMMAND *, int, int, int, struct fd_bitmap *)); +static int time_command PARAMS((COMMAND *, int, int, int, struct fd_bitmap *)); #endif #if defined (ARITH_FOR_COMMAND) -static intmax_t eval_arith_for_expr __P((WORD_LIST *, int *)); -static int execute_arith_for_command __P((ARITH_FOR_COM *)); -#endif -static int execute_case_command __P((CASE_COM *)); -static int execute_while_command __P((WHILE_COM *)); -static int execute_until_command __P((WHILE_COM *)); -static int execute_while_or_until __P((WHILE_COM *, int)); -static int execute_if_command __P((IF_COM *)); -static int execute_null_command __P((REDIRECT *, int, int, int)); -static void fix_assignment_words __P((WORD_LIST *)); -static int execute_simple_command __P((SIMPLE_COM *, int, int, int, struct fd_bitmap *)); -static int execute_builtin __P((sh_builtin_func_t *, WORD_LIST *, int, int)); -static int execute_function __P((SHELL_VAR *, WORD_LIST *, int, struct fd_bitmap *, int, int)); -static int execute_builtin_or_function __P((WORD_LIST *, sh_builtin_func_t *, +static intmax_t eval_arith_for_expr PARAMS((WORD_LIST *, int *)); +static int execute_arith_for_command PARAMS((ARITH_FOR_COM *)); +#endif +static int execute_case_command PARAMS((CASE_COM *)); +static int execute_while_command PARAMS((WHILE_COM *)); +static int execute_until_command PARAMS((WHILE_COM *)); +static int execute_while_or_until PARAMS((WHILE_COM *, int)); +static int execute_if_command PARAMS((IF_COM *)); +static int execute_null_command PARAMS((REDIRECT *, int, int, int)); +static void fix_assignment_words PARAMS((WORD_LIST *)); +static int execute_simple_command PARAMS((SIMPLE_COM *, int, int, int, struct fd_bitmap *)); +static int execute_builtin PARAMS((sh_builtin_func_t *, WORD_LIST *, int, int)); +static int execute_function PARAMS((SHELL_VAR *, WORD_LIST *, int, struct fd_bitmap *, int, int)); +static int execute_builtin_or_function PARAMS((WORD_LIST *, sh_builtin_func_t *, SHELL_VAR *, REDIRECT *, struct fd_bitmap *, int)); -static void execute_subshell_builtin_or_function __P((WORD_LIST *, REDIRECT *, +static void execute_subshell_builtin_or_function PARAMS((WORD_LIST *, REDIRECT *, sh_builtin_func_t *, SHELL_VAR *, int, int, int, struct fd_bitmap *, int)); -static int execute_disk_command __P((WORD_LIST *, REDIRECT *, char *, +static int execute_disk_command PARAMS((WORD_LIST *, REDIRECT *, char *, int, int, int, struct fd_bitmap *, int)); -static char *getinterp __P((char *, int, int *)); -static void initialize_subshell __P((void)); -static int execute_in_subshell __P((COMMAND *, int, int, int, struct fd_bitmap *)); +static char *getinterp PARAMS((char *, int, int *)); +static void initialize_subshell PARAMS((void)); +static int execute_in_subshell PARAMS((COMMAND *, int, int, int, struct fd_bitmap *)); #if defined (COPROCESS_SUPPORT) -static void coproc_setstatus __P((struct coproc *, int)); -static int execute_coproc __P((COMMAND *, int, int, struct fd_bitmap *)); +static void coproc_setstatus PARAMS((struct coproc *, int)); +static int execute_coproc PARAMS((COMMAND *, int, int, struct fd_bitmap *)); #endif -static int execute_pipeline __P((COMMAND *, int, int, int, struct fd_bitmap *)); +static int execute_pipeline PARAMS((COMMAND *, int, int, int, struct fd_bitmap *)); -static int execute_connection __P((COMMAND *, int, int, int, struct fd_bitmap *)); +static int execute_connection PARAMS((COMMAND *, int, int, int, struct fd_bitmap *)); -static int execute_intern_function __P((WORD_DESC *, FUNCTION_DEF *)); +static int execute_intern_function PARAMS((WORD_DESC *, FUNCTION_DEF *)); /* Set to 1 if fd 0 was the subject of redirection to a subshell. Global so that reader_loop can set it to zero before executing a command. */ @@ -1141,9 +1141,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, #if defined (COMMAND_TIMING) #if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY) -extern struct timeval *difftimeval __P((struct timeval *, struct timeval *, struct timeval *)); -extern struct timeval *addtimeval __P((struct timeval *, struct timeval *, struct timeval *)); -extern int timeval_to_cpu __P((struct timeval *, struct timeval *, struct timeval *)); +extern struct timeval *difftimeval PARAMS((struct timeval *, struct timeval *, struct timeval *)); +extern struct timeval *addtimeval PARAMS((struct timeval *, struct timeval *, struct timeval *)); +extern int timeval_to_cpu PARAMS((struct timeval *, struct timeval *, struct timeval *)); #endif #define POSIX_TIMEFORMAT "real %2R\nuser %2U\nsys %2S" @@ -1720,18 +1720,18 @@ typedef struct cplist } cplist_t; -static struct cpelement *cpe_alloc __P((struct coproc *)); -static void cpe_dispose __P((struct cpelement *)); -static struct cpelement *cpl_add __P((struct coproc *)); -static struct cpelement *cpl_delete __P((pid_t)); -static void cpl_reap __P((void)); -static void cpl_flush __P((void)); -static void cpl_closeall __P((void)); -static struct cpelement *cpl_search __P((pid_t)); -static struct cpelement *cpl_searchbyname __P((const char *)); -static void cpl_prune __P((void)); +static struct cpelement *cpe_alloc PARAMS((struct coproc *)); +static void cpe_dispose PARAMS((struct cpelement *)); +static struct cpelement *cpl_add PARAMS((struct coproc *)); +static struct cpelement *cpl_delete PARAMS((pid_t)); +static void cpl_reap PARAMS((void)); +static void cpl_flush PARAMS((void)); +static void cpl_closeall PARAMS((void)); +static struct cpelement *cpl_search PARAMS((pid_t)); +static struct cpelement *cpl_searchbyname PARAMS((const char *)); +static void cpl_prune PARAMS((void)); -static void coproc_free __P((struct coproc *)); +static void coproc_free PARAMS((struct coproc *)); /* Will go away when there is fully-implemented support for multiple coprocs. */ Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0, 0, 0, 0 }; @@ -5143,11 +5143,11 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var, funcvalue = setjmp_nosigs (return_catch); if (result == EXITPROG) - exit (last_command_exit_value); + subshell_exit (last_command_exit_value); else if (result) - exit (EXECUTION_FAILURE); + subshell_exit (EXECUTION_FAILURE); else if (funcvalue) - exit (return_catch_value); + subshell_exit (return_catch_value); else { r = execute_builtin (builtin, words, flags, 1); @@ -5163,14 +5163,14 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var, r = execute_disk_command (words, (REDIRECT *)0, command_line, -1, -1, async, (struct fd_bitmap *)0, flags|CMD_NO_FORK); } - sh_exit (r); + subshell_exit (r); } } else { r = execute_function (var, words, flags, fds_to_close, async, 1); fflush (stdout); - sh_exit (r); + subshell_exit (r); } } diff --git a/jobs.c b/jobs.c index 8ad90dd3d..f2e5973af 100644 --- a/jobs.c +++ b/jobs.c @@ -1225,7 +1225,9 @@ delete_job (job_index, dflags) js.c_injobs -= ndel; if (temp->state == JDEAD) { - js.c_reaped -= ndel; + /* XXX - save_pipeline and restore_pipeline (e.g., for DEBUG trap) can + mess with this total. */ + js.c_reaped -= ndel; /* assumes proc hadn't been reaped earlier */ js.j_ndead--; if (js.c_reaped < 0) { diff --git a/lib/readline/colors.c b/lib/readline/colors.c index 53758e0e7..81aecfe0c 100644 --- a/lib/readline/colors.c +++ b/lib/readline/colors.c @@ -175,7 +175,7 @@ _rl_print_color_indicator (const char *f) if (linkok == -1 && _rl_color_indicator[C_MISSING].string != NULL) colored_filetype = C_MISSING; - else if (linkok == 0 && S_ISLNK(mode) && _rl_color_indicator[C_ORPHAN].string != NULL) + else if (linkok == 0 && _rl_color_indicator[C_ORPHAN].string != NULL) colored_filetype = C_ORPHAN; /* dangling symlink */ else if(stat_ok != 0) { diff --git a/patchlevel.h b/patchlevel.h index deb9c5b74..02f1d6066 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -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 7 +#define PATCHLEVEL 9 #endif /* _PATCHLEVEL_H_ */