commit bash-20171020 snapshot

This commit is contained in:
Chet Ramey
2017-10-23 12:07:54 -04:00
parent 6231100eae
commit f886015aac
11 changed files with 52 additions and 19 deletions
+11
View File
@@ -14373,3 +14373,14 @@ doc/{bash.1,bashref.texi}
lib/readline/doc/{history.3,hstech.texi}
- history_get: clarify the range of valid values for the OFFSET
argument. From a report by Kevin Ryde <user42_kevin@yahoo.com.au>
10/21
-----
subst.c
- expand_string_for_rhs: set W_NOASSNTILDE if the operator is `='
for backwards compatibility with bash-4.4
shell.c
- main: set positional parameters before running the startup files,
so the startup files can inspect $@. Often-requested feature,
most recently from Stephane Chazelas <stephane.chazelas@gmail.com>
+1 -1
View File
@@ -37,7 +37,7 @@ Options:
PATTERN
Arguments:
PATTERN Pattern specifiying a help topic
PATTERN Pattern specifying a help topic
Exit Status:
Returns success unless PATTERN is not found or an invalid option is given.
Vendored
+1 -1
View File
@@ -1566,7 +1566,7 @@ Some influential environment variables:
CC_FOR_BUILD
C compiler used when compiling binaries used only at build time
CFLAGS_FOR_BUILD
Compliation options (CFLAGS) used when compiling binaries used
Compilation options (CFLAGS) used when compiling binaries used
only at build time
LDFLAGS_FOR_BUILD
Linker options (LDFLAGS) used when compiling binaries used only
+1 -1
View File
@@ -248,7 +248,7 @@ AC_ARG_ENABLE(static-link, AC_HELP_STRING([--enable-static-link], [link bash sta
dnl So-called `precious' variables
AC_ARG_VAR([CC_FOR_BUILD], [C compiler used when compiling binaries used only at build time])
AC_ARG_VAR([CFLAGS_FOR_BUILD], [Compliation options (CFLAGS) used when compiling binaries used only at build time])
AC_ARG_VAR([CFLAGS_FOR_BUILD], [Compilation options (CFLAGS) used when compiling binaries used only at build time])
AC_ARG_VAR([LDFLAGS_FOR_BUILD], [Linker options (LDFLAGS) used when compiling binaries used only at build time])
AC_ARG_VAR([CPPFLAGS_FOR_BUILD], [C preprocessor options (CPPFLAGS) used when compiling binaries used only at build time])
+1 -1
View File
@@ -22,7 +22,7 @@
#
# Declare a function ($1) to be autoloaded from a file ($2) when it is first
# called. This defines a `temporary' function that will `.' the file
# containg the real function definition, then execute that new definition with
# containing the real function definition, then execute that new definition with
# the arguments given to this `fake' function. The autoload function defined
# by the file and the file itself *must* be named identically.
#
+1 -1
View File
@@ -38,7 +38,7 @@ WORD_LIST *list;
char *necho_doc[] = {
"Display arguments.",
"",
"Print the arguments to the standard ouput separated",
"Print the arguments to the standard output separated",
"by space characters and terminated with a newline.",
(char *)NULL
};
+1 -1
View File
@@ -136,7 +136,7 @@ char *pathchk_doc[] = {
"Check pathnames for validity.",
"",
"Check each pathname argument for validity (i.e., it may be used to",
"create or access a file without casuing syntax errors) and portability",
"create or access a file without causing syntax errors) and portability",
"(i.e., no filename truncation will result). If the `-p' option is",
"supplied, more extensive portability checks are performed.",
(char *)NULL
+4
View File
@@ -356,6 +356,9 @@ parameters managing the list itself.
.Fn1 void add_history "const char *string"
Place \fIstring\fP at the end of the history list. The associated data
field (if any) is set to \fBNULL\fP.
If the maximum number of history entries has been set using
\fBstifle_history()\fP, and the new number of history entries would exceed
that maximum, the oldest history entry is removed.
.Fn1 void add_history_time "const char *string"
Change the time stamp associated with the most recent history entry to
@@ -382,6 +385,7 @@ Clear the history list by deleting all the entries.
.Fn1 void stifle_history "int max"
Stifle the history list, remembering only the last \fImax\fP entries.
The history list will contain only \fImax\fP entries at a time.
.Fn1 int unstifle_history "void"
Stop stifling the history. This returns the previously-set
+4
View File
@@ -166,6 +166,9 @@ parameters managing the list itself.
@deftypefun void add_history (const char *string)
Place @var{string} at the end of the history list. The associated data
field (if any) is set to @code{NULL}.
If the maximum number of history entries has been set using
@code{stifle_history()}, and the new number of history entries would exceed
that maximum, the oldest history entry is removed.
@end deftypefun
@deftypefun void add_history_time (const char *string)
@@ -198,6 +201,7 @@ Clear the history list by deleting all the entries.
@deftypefun void stifle_history (int max)
Stifle the history list, remembering only the last @var{max} entries.
The history list will contain only @var{max} entries at a time.
@end deftypefun
@deftypefun int unstifle_history (void)
+23 -13
View File
@@ -1,6 +1,6 @@
/* shell.c -- GNU's idea of the POSIX shell specification. */
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -291,6 +291,7 @@ int want_pending_command; /* -c flag supplied */
/* This variable is not static so it can be bound to $BASH_EXECUTION_STRING */
char *command_execution_string; /* argument to -c option */
char *shell_script_filename; /* shell script */
int malloc_trace_at_exit = 0;
@@ -427,7 +428,7 @@ main (argc, argv, env)
arg_index = 1;
if (arg_index > argc)
arg_index = argc;
command_execution_string = (char *)NULL;
command_execution_string = shell_script_filename = (char *)NULL;
want_pending_command = locally_skip_execution = read_from_stdin = 0;
default_input = stdin;
#if defined (BUFFERED_INPUT)
@@ -667,6 +668,22 @@ main (argc, argv, env)
restricted = 0;
#endif
/* Set positional parameters before running startup files. top_level_arg_index
holds the index of the current argument before setting the positional
parameters, so any changes performed in the startup files won't affect
later option processing. */
if (wordexp_only)
; /* nothing yet */
else if (command_execution_string)
arg_index = bind_args (argv, arg_index, argc, 0); /* $0 ... $n */
else if (arg_index != argc && read_from_stdin == 0)
{
shell_script_filename = argv[arg_index++];
arg_index = bind_args (argv, arg_index, argc, 1); /* $1 ... $n */
}
else
arg_index = bind_args (argv, arg_index, argc, 1); /* $1 ... $n */
/* The startup files are run with `set -e' temporarily disabled. */
if (locally_skip_execution == 0 && running_setuid == 0)
{
@@ -697,7 +714,7 @@ main (argc, argv, env)
if (wordexp_only)
{
startup_state = 3;
last_command_exit_value = run_wordexp (argv[arg_index]);
last_command_exit_value = run_wordexp (argv[top_level_arg_index]);
exit_shell (last_command_exit_value);
}
#endif
@@ -707,7 +724,6 @@ main (argc, argv, env)
if (command_execution_string)
{
arg_index = bind_args (argv, arg_index, argc, 0);
startup_state = 2;
if (debugging_mode)
@@ -725,11 +741,8 @@ main (argc, argv, env)
/* Get possible input filename and set up default_buffered_input or
default_input as appropriate. */
if (arg_index != argc && read_from_stdin == 0)
{
open_shell_script (argv[arg_index]);
arg_index++;
}
if (shell_script_filename)
open_shell_script (shell_script_filename);
else if (interactive == 0)
{
/* In this mode, bash is reading a script from stdin, which is a
@@ -741,16 +754,13 @@ main (argc, argv, env)
#endif /* !BUFFERED_INPUT */
read_from_stdin = 1;
}
else if (arg_index == argc)
else if (top_level_arg_index == argc) /* arg index before startup files */
/* "If there are no operands and the -c option is not specified, the -s
option shall be assumed." */
read_from_stdin = 1;
set_bash_input ();
/* Bind remaining args to $1 ... $n */
arg_index = bind_args (argv, arg_index, argc, 1);
if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && (reading_shell_script || interactive_shell == 0))
start_debugger ();
+4
View File
@@ -3868,7 +3868,11 @@ expand_string_for_rhs (string, quoted, op, pflags, dollar_at_p, expanded_p)
if (pflags & PF_ASSIGNRHS) /* pass through */
td.flags |= W_ASSIGNRHS;
if (op == '=')
#if 0
td.flags |= W_ASSIGNRHS; /* expand b in ${a=b} like assignment */
#else
td.flags |= W_ASSIGNRHS|W_NOASSNTILDE; /* expand b in ${a=b} like assignment */
#endif
td.word = string;
tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, expanded_p);
expand_no_split_dollar_star = old_nosplit;