commit bash-20160812 snapshot

This commit is contained in:
Chet Ramey
2016-08-18 14:55:56 -04:00
parent ec69166705
commit f8c5768ef2
23 changed files with 198 additions and 73 deletions
+3
View File
@@ -24,6 +24,9 @@ g. Fixed a bug that caused a shell compiled without job control to use the inco
exit status for builtin commands preceded by a command executed from the file
system that causes the shell to call waitpid().
h. Improved word completion for quoted strings containing unterminated command
substitutions with embedded double quotes.
2. Changes to Readline
a. Fixed a bug that caused mode strings to be displayed incorrectly if the prompt was
+3
View File
@@ -24,6 +24,9 @@ g. Fixed a bug that caused a shell compiled without job control to use the inco
exit status for builtin commands preceded by a command executed from the file
system that causes the shell to call waitpid().
h. Improved word completion for quoted strings containing unterminated command
substitutions with embedded double quotes.
2. Changes to Readline
a. Fixed a bug that caused mode strings to be displayed incorrectly if the prompt was
+58 -1
View File
@@ -11065,7 +11065,7 @@ pcomplete.c
config-top.h
- USE_MKTEMP/USE_MKSTEMP: define by default to use libc version of mktemp
and mkstemp in lib/sh/tmpfile.c. Recommended by by Mike Frysinger
and mkstemp in lib/sh/tmpfile.c. Recommended by Mike Frysinger
<vapier@gentoo.org> to fix a FreeBSD problem
configure.ac,config.h.in
@@ -11523,3 +11523,60 @@ subst.c
expand double-quoted string. Fixes bug reported by John Passaro
<john.a.passaro@gmail.com>
8/9
---
[bash-4.4-rc2 frozen]
8/10
----
subst.c
- sub_append_string: use size_t variable to store string length to
avoid integer overflow. Report from Siteshwar Vashisht
<svashisht@redhat.com>
- sub_append_string: `size' argument is now pointer to size_t; changed
istring_index in expand_word_internal to accommodate change
lib/sh/ufuncs.c
- include "posixselect.h" if HAVE_SELECT is defined, make sure that
fd_set and the rest are defined
8/11
----
lib/readline/histexpand.c
- history_tokenize_word: use ISDIGIT instead of isdigit for more
argument checking
- "chardefs.h": include for ISDIGIT define and <ctype.h>. Fix from
Mike Frysinger <vapier@gentoo.org>
lib/sh/eaccess.c,externs.h
- sh_eaccess: first argument now const char *
- sh_stataccess,sh_euidaccess: first argument now const char *, since
sh_stat and sh_eaccess call them.
Fix from Mike Frysinger <vapier@gentoo.org>
lib/glob/glob.c
- sh_eaccess: change local prototype
general.[ch]
- all_digits,legal_identifier,valid_nameref_value,importable_function_name,
exportable_function_name,check_binary_file,file_exists,file_isdir,
file_iswdir,same_file,make_absolute,valid_nameref_value: first
argument (always identifier or filename) is now a `const char *';
some second filename arguments now `const char *'.
Fix from Mike Frysinger <vapier@gentoo.org>
configure.ac,config.h.in
- uintptr_t: make sure it's defined to an integer type wide enough to
hold a pointer
lib/sh/tmpfile.c
- sh_seedrand: use `uintptr_t' to cast pointer value to int value,
instead of allowing truncation to take place, since srandom takes
an `unsigned int'.
Fix from Mike Frysinger <vapier@gentoo.org>
arrayfunc.[ch]
- valid_array_reference,array_variable_name,array_variable_part,
array_value_internal,array_value,get_array_value: first argument
(always variable name) now a `const char *'
Fix from Mike Frysinger <vapier@gentoo.org>
+4 -1
View File
@@ -55,6 +55,9 @@
static char *array_to_string_internal __P((ARRAY_ELEMENT *, ARRAY_ELEMENT *, char *, int));
/* lastref should be moved into the array structure so each array can be
optimized separately */
static ARRAY *lastarray = 0;
static ARRAY_ELEMENT *lastref = 0;
@@ -719,7 +722,7 @@ arrayind_t i;
SET_LASTREF(a, ae);
return(element_value(ae));
}
UNSET_LASTREF();
UNSET_LASTREF(); /* XXX SET_LASTREF(a, start) ? */
return((char *) NULL);
}
+10 -8
View File
@@ -1,6 +1,6 @@
/* arrayfunc.c -- High-level array functions used by other parts of the shell. */
/* Copyright (C) 2001-2015 Free Software Foundation, Inc.
/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -48,7 +48,7 @@ static SHELL_VAR *assign_array_element_internal __P((SHELL_VAR *, char *, char *
static char *quote_assign __P((const char *));
static void quote_array_assignment_chars __P((WORD_LIST *));
static char *array_value_internal __P((char *, int, int, int *, arrayind_t *));
static char *array_value_internal __P((const char *, int, int, int *, arrayind_t *));
/* Standard error message to use when encountering an invalid array subscript */
const char * const bash_badsub_errmsg = N_("bad array subscript");
@@ -881,7 +881,7 @@ print_assoc_assignment (var, quoted)
/* Return 1 if NAME is a properly-formed array reference v[sub]. */
int
valid_array_reference (name, flags)
char *name;
const char *name;
int flags;
{
char *t;
@@ -948,7 +948,8 @@ array_expand_index (var, s, len)
in *LENP. This returns newly-allocated memory. */
char *
array_variable_name (s, subp, lenp)
char *s, **subp;
const char *s;
char **subp;
int *lenp;
{
char *t, *ret;
@@ -992,7 +993,8 @@ array_variable_name (s, subp, lenp)
If LENP is non-null, the length of the subscript is returned in *LENP. */
SHELL_VAR *
array_variable_part (s, subp, lenp)
char *s, **subp;
const char *s;
char **subp;
int *lenp;
{
char *t;
@@ -1029,7 +1031,7 @@ array_variable_part (s, subp, lenp)
reference is name[@], and 0 otherwise. */
static char *
array_value_internal (s, quoted, flags, rtype, indp)
char *s;
const char *s;
int quoted, flags, *rtype;
arrayind_t *indp;
{
@@ -1150,7 +1152,7 @@ array_value_internal (s, quoted, flags, rtype, indp)
subscript contained in S, obeying quoting for subscripts * and @. */
char *
array_value (s, quoted, flags, rtype, indp)
char *s;
const char *s;
int quoted, flags, *rtype;
arrayind_t *indp;
{
@@ -1163,7 +1165,7 @@ array_value (s, quoted, flags, rtype, indp)
evaluator in expr.c. */
char *
get_array_value (s, flags, rtype, indp)
char *s;
const char *s;
int flags, *rtype;
arrayind_t *indp;
{
+5 -5
View File
@@ -59,14 +59,14 @@ extern void print_array_assignment __P((SHELL_VAR *, int));
extern void print_assoc_assignment __P((SHELL_VAR *, int));
extern arrayind_t array_expand_index __P((SHELL_VAR *, char *, int));
extern int valid_array_reference __P((char *, int));
extern char *array_value __P((char *, int, int, int *, arrayind_t *));
extern char *get_array_value __P((char *, int, int *, arrayind_t *));
extern int valid_array_reference __P((const char *, int));
extern char *array_value __P((const char *, int, int, int *, arrayind_t *));
extern char *get_array_value __P((const char *, int, int *, arrayind_t *));
extern char *array_keys __P((char *, int));
extern char *array_variable_name __P((char *, char **, int *));
extern SHELL_VAR *array_variable_part __P((char *, char **, int *));
extern char *array_variable_name __P((const char *, char **, int *));
extern SHELL_VAR *array_variable_part __P((const char *, char **, int *));
#else
+6 -6
View File
@@ -241,8 +241,8 @@ parse_and_execute (string, from_file, flags)
#if defined (HAVE_POSIX_SIGNALS)
/* If we longjmp and are going to go on, use this to restore signal mask */
sigemptyset (&pe_sigmask);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &pe_sigmask);
sigemptyset ((sigset_t *)&pe_sigmask);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, (sigset_t *)&pe_sigmask);
#endif
/* Reset the line number if the caller wants us to. If we don't reset the
@@ -326,7 +326,7 @@ parse_and_execute (string, from_file, flags)
dispose_command (command); /* pe_dispose does this */
#endif
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &pe_sigmask, (sigset_t *)NULL);
sigprocmask (SIG_SETMASK, (sigset_t *)&pe_sigmask, (sigset_t *)NULL);
#endif
continue;
}
@@ -494,8 +494,8 @@ parse_string (string, from_file, flags, endp)
#if defined (HAVE_POSIX_SIGNALS)
/* If we longjmp and are going to go on, use this to restore signal mask */
sigemptyset (&ps_sigmask);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &ps_sigmask);
sigemptyset ((sigset_t *)&ps_sigmask);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, (sigset_t *)&ps_sigmask);
#endif
/*itrace("parse_string: `%s'", string);*/
@@ -547,7 +547,7 @@ itrace("parse_string: longjmp executed: code = %d", code);
default:
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &ps_sigmask, (sigset_t *)NULL);
sigprocmask (SIG_SETMASK, (sigset_t *)&ps_sigmask, (sigset_t *)NULL);
#endif
command_error ("parse_string", CMDERR_BADJUMP, code, 0);
break;
+3
View File
@@ -332,6 +332,9 @@
/* Define to `unsigned long' if <stdint.h> doesn't define. */
#undef uintmax_t
/* Define to integer type wide enough to hold a pointer if <stdint.h> doesn't define. */
#undef uintptr_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
Vendored
+38
View File
@@ -11941,6 +11941,44 @@ _ACEOF
fi
ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
if test "x$ac_cv_type_uintptr_t" = xyes; then :
$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h
else
for ac_type in 'unsigned int' 'unsigned long int' \
'unsigned long long int'; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat >>confdefs.h <<_ACEOF
#define uintptr_t $ac_type
_ACEOF
ac_type=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test -z "$ac_type" && break
done
fi
ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
if test "x$ac_cv_type_ssize_t" = xyes; then :
+2
View File
@@ -891,6 +891,8 @@ AC_TYPE_MODE_T
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINTPTR_T
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_TYPE(time_t, long)
+1 -1
View File
@@ -305,7 +305,7 @@ extern int sh_setlinebuf __P((FILE *));
#endif
/* declarations for functions defined in lib/sh/shaccess.c */
extern int sh_eaccess __P((char *, int));
extern int sh_eaccess __P((const char *, int));
/* declarations for functions defined in lib/sh/shmatch.c */
extern int sh_regmatch __P((const char *, const char *, int));
+16 -16
View File
@@ -154,9 +154,9 @@ print_rlimtype (n, addnl)
/* Return non-zero if all of the characters in STRING are digits. */
int
all_digits (string)
char *string;
const char *string;
{
register char *s;
register const char *s;
for (s = string; *s; s++)
if (DIGIT (*s) == 0)
@@ -211,9 +211,9 @@ legal_number (string, result)
digit. */
int
legal_identifier (name)
char *name;
const char *name;
{
register char *s;
register const char *s;
unsigned char c;
if (!name || !(c = *name) || (legal_variable_starter (c) == 0))
@@ -234,7 +234,7 @@ legal_identifier (name)
not used in assignments. */
int
valid_nameref_value (name, flags)
char *name;
const char *name;
int flags;
{
if (name == 0 || *name == 0)
@@ -254,7 +254,7 @@ valid_nameref_value (name, flags)
int
check_selfref (name, value, flags)
const char *name;
const char *value;
char *value;
int flags;
{
char *t;
@@ -309,7 +309,7 @@ check_identifier (word, check_word)
used yet. */
int
importable_function_name (string, len)
char *string;
const char *string;
size_t len;
{
if (absolute_program (string)) /* don't allow slash */
@@ -323,7 +323,7 @@ importable_function_name (string, len)
int
exportable_function_name (string)
char *string;
const char *string;
{
if (absolute_program (string))
return 0;
@@ -337,10 +337,10 @@ exportable_function_name (string)
parser (which disqualifies them from alias expansion anyway) and `/'. */
int
legal_alias_name (string, flags)
char *string;
const char *string;
int flags;
{
register char *s;
register const char *s;
for (s = string; *s; s++)
if (shellbreak (*s) || shellxquote (*s) || shellexp (*s) || (*s == '/'))
@@ -497,7 +497,7 @@ check_dev_tty ()
corresponding to PATH1 and PATH2, respectively. */
int
same_file (path1, path2, stp1, stp2)
char *path1, *path2;
const char *path1, *path2;
struct stat *stp1, *stp2;
{
struct stat st1, st2;
@@ -566,7 +566,7 @@ move_to_high_fd (fd, check_new, maxfd)
int
check_binary_file (sample, sample_len)
char *sample;
const char *sample;
int sample_len;
{
register int i;
@@ -627,7 +627,7 @@ sh_closepipe (pv)
int
file_exists (fn)
char *fn;
const char *fn;
{
struct stat sb;
@@ -636,7 +636,7 @@ file_exists (fn)
int
file_isdir (fn)
char *fn;
const char *fn;
{
struct stat sb;
@@ -645,7 +645,7 @@ file_isdir (fn)
int
file_iswdir (fn)
char *fn;
const char *fn;
{
return (file_isdir (fn) && sh_eaccess (fn, W_OK) == 0);
}
@@ -709,7 +709,7 @@ absolute_program (string)
begin with. */
char *
make_absolute (string, dot_path)
char *string, *dot_path;
const char *string, *dot_path;
{
char *result;
+13 -13
View File
@@ -283,15 +283,15 @@ extern RLIMTYPE string_to_rlimtype __P((char *));
extern void print_rlimtype __P((RLIMTYPE, int));
#endif
extern int all_digits __P((char *));
extern int all_digits __P((const char *));
extern int legal_number __P((const char *, intmax_t *));
extern int legal_identifier __P((char *));
extern int importable_function_name __P((char *, size_t));
extern int exportable_function_name __P((char *));
extern int legal_identifier __P((const char *));
extern int importable_function_name __P((const char *, size_t));
extern int exportable_function_name __P((const char *));
extern int check_identifier __P((WORD_DESC *, int));
extern int valid_nameref_value __P((char *, int));
extern int check_selfref __P((const char *, const char *, int));
extern int legal_alias_name __P((char *, int));
extern int valid_nameref_value __P((const char *, int));
extern int check_selfref __P((const char *, char *, int));
extern int legal_alias_name __P((const char *, int));
extern int assignment __P((const char *, int));
extern int sh_unset_nodelay_mode __P((int));
@@ -299,23 +299,23 @@ extern int sh_validfd __P((int));
extern int fd_ispipe __P((int));
extern void check_dev_tty __P((void));
extern int move_to_high_fd __P((int, int, int));
extern int check_binary_file __P((char *, int));
extern int check_binary_file __P((const char *, int));
#ifdef _POSIXSTAT_H_
extern int same_file __P((char *, char *, struct stat *, struct stat *));
extern int same_file __P((const char *, const char *, struct stat *, struct stat *));
#endif
extern int sh_openpipe __P((int *));
extern int sh_closepipe __P((int *));
extern int file_exists __P((char *));
extern int file_isdir __P((char *));
extern int file_iswdir __P((char *));
extern int file_exists __P((const char *));
extern int file_isdir __P((const char *));
extern int file_iswdir __P((const char *));
extern int path_dot_or_dotdot __P((const char *));
extern int absolute_pathname __P((const char *));
extern int absolute_program __P((const char *));
extern char *make_absolute __P((char *, char *));
extern char *make_absolute __P((const char *, const char *));
extern char *base_pathname __P((char *));
extern char *full_pathname __P((char *));
extern char *polite_directory_format __P((char *));
+1 -1
View File
@@ -84,7 +84,7 @@ struct globval
};
extern void throw_to_top_level __P((void));
extern int sh_eaccess __P((char *, int));
extern int sh_eaccess __P((const char *, int));
extern char *sh_makepath __P((const char *, const char *, int));
extern int signal_is_pending __P((int));
extern void run_pending_traps __P((void));
+4 -3
View File
@@ -44,6 +44,7 @@
#include "history.h"
#include "histlib.h"
#include "chardefs.h"
#include "rlshell.h"
#include "xmalloc.h"
@@ -1433,10 +1434,10 @@ history_tokenize_word (string, ind)
return i;
}
if (isdigit (string[i]))
if (ISDIGIT (string[i]))
{
j = i;
while (string[j] && isdigit (string[j]))
while (string[j] && ISDIGIT (string[j]))
j++;
if (string[j] == 0)
return (j);
@@ -1465,7 +1466,7 @@ history_tokenize_word (string, ind)
else if (peek == '&' && (string[i] == '>' || string[i] == '<'))
{
j = i + 2;
while (string[j] && isdigit (string[j])) /* file descriptor */
while (string[j] && ISDIGIT (string[j])) /* file descriptor */
j++;
if (string[j] =='-') /* <&[digits]-, >&[digits]- */
j++;
+5 -5
View File
@@ -53,9 +53,9 @@ extern int errno;
#endif /* R_OK */
static int path_is_devfd __P((const char *));
static int sh_stataccess __P((char *, int));
static int sh_stataccess __P((const char *, int));
#if HAVE_DECL_SETREGID
static int sh_euidaccess __P((char *, int));
static int sh_euidaccess __P((const char *, int));
#endif
static int
@@ -135,7 +135,7 @@ sh_stat (path, finfo)
executable. This version uses stat(2). */
static int
sh_stataccess (path, mode)
char *path;
const char *path;
int mode;
{
struct stat st;
@@ -172,7 +172,7 @@ sh_stataccess (path, mode)
the effective and real uid and gid as appropriate. */
static int
sh_euidaccess (path, mode)
char *path;
const char *path;
int mode;
{
int r, e;
@@ -197,7 +197,7 @@ sh_euidaccess (path, mode)
int
sh_eaccess (path, mode)
char *path;
const char *path;
int mode;
{
int ret;
+1 -1
View File
@@ -44,7 +44,7 @@ int
isnetconn (fd)
int fd;
{
#if defined (HAVE_GETPEERNAME) && !defined (SVR4_2) && !defined (__BEOS__)
#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && !defined (SVR4_2) && !defined (__BEOS__)
int rv;
socklen_t l;
struct sockaddr sa;
+1 -1
View File
@@ -125,7 +125,7 @@ sh_seedrand ()
struct timeval tv;
gettimeofday (&tv, NULL);
srandom (tv.tv_sec ^ tv.tv_usec ^ (getpid () << 16) ^ (unsigned int)&d);
srandom (tv.tv_sec ^ tv.tv_usec ^ (getpid () << 16) ^ (uintptr_t)&d);
seeded = 1;
}
#endif
+4
View File
@@ -37,6 +37,10 @@
#include <unistd.h>
#endif
#if defined (HAVE_SELECT)
# include "posixselect.h"
#endif
/* A version of `alarm' using setitimer if it's available. */
#if defined (HAVE_SETITIMER)
+2 -1
View File
@@ -5459,7 +5459,8 @@ decode_prompt_string (string)
struct dstack save_dstack;
int last_exit_value, last_comsub_pid;
#if defined (PROMPT_STRING_DECODE)
int result_size, result_index;
size_t result_size;
int result_index;
int c, n, i;
char *temp, *t_host, octal_string[4];
struct tm *tm;
+15 -9
View File
@@ -705,11 +705,13 @@ unquoted_substring (substr, string)
INLINE char *
sub_append_string (source, target, indx, size)
char *source, *target;
int *indx, *size;
int *indx;
size_t *size;
{
if (source)
{
int srclen, n;
int n;
size_t srclen;
srclen = STRLEN (source);
if (srclen >= (int)(*size - *indx))
@@ -735,8 +737,9 @@ sub_append_string (source, target, indx, size)
char *
sub_append_number (number, target, indx, size)
intmax_t number;
int *indx, *size;
char *target;
int *indx;
size_t *size;
{
char *temp;
@@ -2375,7 +2378,7 @@ string_list_internal (list, sep)
{
register WORD_LIST *t;
char *result, *r;
int word_len, sep_len, result_size;
size_t word_len, sep_len, result_size;
if (list == 0)
return ((char *)NULL);
@@ -4211,7 +4214,7 @@ remove_upattern (param, pattern, op)
char *param, *pattern;
int op;
{
register int len;
register size_t len;
register char *end;
register char *p, *ret, c;
@@ -4423,7 +4426,8 @@ match_upattern (string, pat, mtype, sp, ep)
int mtype;
char **sp, **ep;
{
int c, len, mlen;
int c, mlen;
size_t len;
register char *p, *p1, *npat;
char *end;
int n1;
@@ -7182,7 +7186,8 @@ mb_substring (string, s, e)
int s, e;
{
char *tt;
int start, stop, i, slen;
int start, stop, i;
size_t slen;
DECLARE_MBSTATE;
start = 0;
@@ -7323,7 +7328,8 @@ pat_subst (string, pat, rep, mflags)
int mflags;
{
char *ret, *s, *e, *str, *rstr, *mstr;
int rsize, rptr, l, replen, mtype, rxpand, rslen, mlen;
int rptr, mtype, rxpand, mlen;
size_t rsize, l, replen, rslen;
if (string == 0)
return (savestring (""));
@@ -8951,7 +8957,7 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
char *istring;
/* The current size of the above object. */
int istring_size;
size_t istring_size;
/* Index into ISTRING. */
int istring_index;
+1 -1
View File
@@ -138,7 +138,7 @@ extern int do_word_assignment __P((WORD_DESC *, int));
of space allocated to TARGET. SOURCE can be NULL, in which
case nothing happens. Gets rid of SOURCE by free ()ing it.
Returns TARGET in case the location has changed. */
extern char *sub_append_string __P((char *, char *, int *, int *));
extern char *sub_append_string __P((char *, char *, int *, size_t *));
/* Append the textual representation of NUMBER to TARGET.
INDEX and SIZE are as in SUB_APPEND_STRING. */
+2
View File
@@ -36,6 +36,8 @@
extern int errno;
#endif
extern int optind;
#define LOWER 1
#define UPPER 2