mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 08:29:54 +02:00
commit bash-20180622 snapshot
This commit is contained in:
+34
-11697
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -831,7 +831,7 @@ compopt_builtin (list)
|
||||
WORD_LIST *l, *wl;
|
||||
COMPSPEC *cs;
|
||||
|
||||
opts_on = opts_off = Eflag = Dflag = 0;
|
||||
opts_on = opts_off = Eflag = Dflag = Iflag = 0;
|
||||
ret = EXECUTION_SUCCESS;
|
||||
|
||||
reset_internal_getopt ();
|
||||
|
||||
@@ -1028,6 +1028,9 @@
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/mman.h> header file. */
|
||||
#undef HAVE_SYS_MMAN_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac for Bash 5.0, version 4.091.
|
||||
# From configure.ac for Bash 5.0, version 4.092.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for bash 5.0-alpha.
|
||||
#
|
||||
@@ -9292,7 +9292,7 @@ fi
|
||||
done
|
||||
|
||||
for ac_header in sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
|
||||
sys/param.h sys/socket.h sys/stat.h \
|
||||
sys/mman.h sys/param.h sys/socket.h sys/stat.h \
|
||||
sys/time.h sys/times.h sys/types.h sys/wait.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 5.0, version 4.091])dnl
|
||||
AC_REVISION([for Bash 5.0, version 4.092])dnl
|
||||
|
||||
define(bashvers, 5.0)
|
||||
define(relstatus, alpha)
|
||||
@@ -714,7 +714,7 @@ AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
|
||||
stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \
|
||||
regex.h syslog.h ulimit.h)
|
||||
AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
|
||||
sys/param.h sys/socket.h sys/stat.h \
|
||||
sys/mman.h sys/param.h sys/socket.h sys/stat.h \
|
||||
sys/time.h sys/times.h sys/types.h sys/wait.h)
|
||||
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
|
||||
|
||||
|
||||
+4
-2
@@ -1506,7 +1506,8 @@ only when in extended debugging mode (see the description of the
|
||||
option to the
|
||||
.B shopt
|
||||
builtin below).
|
||||
Setting \fBextdebug\fP after the shell has started to execute a script
|
||||
Setting \fBextdebug\fP after the shell has started to execute a script,
|
||||
or referencing this variable when \fBextdebug\fP is not set,
|
||||
may result in inconsistent values.
|
||||
.TP
|
||||
.B BASH_ARGV
|
||||
@@ -1526,7 +1527,8 @@ only when in extended debugging mode
|
||||
option to the
|
||||
.B shopt
|
||||
builtin below).
|
||||
Setting \fBextdebug\fP after the shell has started to execute a script
|
||||
Setting \fBextdebug\fP after the shell has started to execute a script,
|
||||
or referencing this variable when \fBextdebug\fP is not set,
|
||||
may result in inconsistent values.
|
||||
.TP
|
||||
.B BASH_ARGV0
|
||||
|
||||
+4
-2
@@ -5636,7 +5636,8 @@ The shell sets @code{BASH_ARGC} only when in extended debugging mode
|
||||
(see @ref{The Shopt Builtin}
|
||||
for a description of the @code{extdebug} option to the @code{shopt}
|
||||
builtin).
|
||||
Setting @code{extdebug} after the shell has started to execute a script
|
||||
Setting @code{extdebug} after the shell has started to execute a script,
|
||||
or referencing this variable when @code{extdebug} is not set,
|
||||
may result in inconsistent values.
|
||||
|
||||
@item BASH_ARGV
|
||||
@@ -5649,7 +5650,8 @@ The shell sets @code{BASH_ARGV} only when in extended debugging mode
|
||||
(see @ref{The Shopt Builtin}
|
||||
for a description of the @code{extdebug} option to the @code{shopt}
|
||||
builtin).
|
||||
Setting @code{extdebug} after the shell has started to execute a script
|
||||
Setting @code{extdebug} after the shell has started to execute a script,
|
||||
or referencing this variable when @code{extdebug} is not set,
|
||||
may result in inconsistent values.
|
||||
|
||||
@item BASH_ARGV0
|
||||
|
||||
@@ -48,13 +48,6 @@
|
||||
#include "builtins.h"
|
||||
#include "common.h"
|
||||
|
||||
#define RETURN(x) \
|
||||
do { \
|
||||
if (sp) *sp = sec; \
|
||||
if (usp) *usp = usec; \
|
||||
return (x); \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
sleep_builtin (list)
|
||||
WORD_LIST *list;
|
||||
|
||||
+58
-4
@@ -84,6 +84,10 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_MMAP)
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
/* Define getpagesize () if the system does not. */
|
||||
#ifndef HAVE_GETPAGESIZE
|
||||
# include "getpagesize.h"
|
||||
@@ -196,10 +200,25 @@ typedef union _malloc_guard {
|
||||
#define LESSCORE_MIN 10
|
||||
#define LESSCORE_FRC 13
|
||||
|
||||
#define MMAP_THRESHOLD 15 /* must be greater than SPLIT_MAX, COMBINE_MAX */
|
||||
|
||||
#define STARTBUCK 1
|
||||
|
||||
/* Should we use mmap for large allocations? */
|
||||
#if defined (HAVE_MMAP)
|
||||
# if !defined (MAP_ANON) && defined (MAP_ANONYMOUS)
|
||||
# define MAP_ANON MAP_ANONYMOUS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_MMAP) && defined (MAP_ANON)
|
||||
# define USE_MMAP
|
||||
#endif
|
||||
|
||||
#if defined (USE_MMAP)
|
||||
# define MMAP_THRESHOLD 14 /* must be >= SPLIT_MAX, COMBINE_MAX */
|
||||
#else
|
||||
# define MMAP_THRESHOLD (8 * SIZEOF_LONG)
|
||||
#endif
|
||||
|
||||
/* Flags for the internal functions. */
|
||||
#define MALLOC_WRAPPER 0x01 /* wrapper function */
|
||||
#define MALLOC_INTERNAL 0x02 /* internal function calling another */
|
||||
@@ -291,6 +310,9 @@ int malloc_flags = 0; /* future use */
|
||||
int malloc_trace = 0; /* trace allocations and frees to stderr */
|
||||
int malloc_register = 0; /* future use */
|
||||
|
||||
/* Use a variable in case we want to dynamically adapt it in the future */
|
||||
int malloc_mmap_threshold = MMAP_THRESHOLD;
|
||||
|
||||
#ifdef MALLOC_TRACE
|
||||
char _malloc_trace_buckets[NBUCKETS];
|
||||
|
||||
@@ -597,7 +619,7 @@ morecore (nu)
|
||||
|
||||
/* Try to split a larger block here, if we're within the range of sizes
|
||||
to split. */
|
||||
if (nu >= SPLIT_MIN)
|
||||
if (nu >= SPLIT_MIN && nu <= malloc_mmap_threshold)
|
||||
{
|
||||
bsplit (nu);
|
||||
if (nextf[nu] != 0)
|
||||
@@ -606,7 +628,7 @@ morecore (nu)
|
||||
|
||||
/* Try to coalesce two adjacent blocks from the free list on nextf[nu - 1],
|
||||
if we can, and we're within the range of the block coalescing limits. */
|
||||
if (nu >= COMBINE_MIN && nu < COMBINE_MAX && busy[nu - 1] == 0 && nextf[nu - 1])
|
||||
if (nu >= COMBINE_MIN && nu < COMBINE_MAX && nu <= malloc_mmap_threshold && busy[nu - 1] == 0 && nextf[nu - 1])
|
||||
{
|
||||
bcoalesce (nu);
|
||||
if (nextf[nu] != 0)
|
||||
@@ -635,6 +657,25 @@ morecore (nu)
|
||||
nblks = 1;
|
||||
}
|
||||
|
||||
#if defined (USE_MMAP)
|
||||
if (nu > malloc_mmap_threshold)
|
||||
{
|
||||
mp = (union mhead *)mmap (0, sbrk_amt, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
if ((void *)mp == MAP_FAILED)
|
||||
goto morecore_done;
|
||||
nextf[nu] = mp;
|
||||
mp->mh_alloc = ISFREE;
|
||||
mp->mh_index = nu;
|
||||
CHAIN (mp) = 0;
|
||||
#ifdef MALLOC_STATS
|
||||
_mstats.nmmap++;
|
||||
_mstats.tmmap += sbrk_amt;
|
||||
#endif
|
||||
goto morecore_done;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
_mstats.nsbrk++;
|
||||
_mstats.tsbrk += sbrk_amt;
|
||||
@@ -918,6 +959,17 @@ internal_free (mem, file, line, flags)
|
||||
if (mg.i != p->mh_nbytes)
|
||||
xbotch (mem, ERR_ASSERT_FAILED, _("free: start and end chunk sizes differ"), file, line);
|
||||
|
||||
#if defined (USE_MMAP)
|
||||
if (nunits > malloc_mmap_threshold)
|
||||
{
|
||||
munmap (p, binsize (nunits));
|
||||
#if defined (MALLOC_STATS)
|
||||
_mstats.nlesscore[nunits]++;
|
||||
#endif
|
||||
goto free_return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GLIBC21
|
||||
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == sbrk (0)))
|
||||
#else
|
||||
@@ -1076,6 +1128,8 @@ internal_realloc (mem, n, file, line, flags)
|
||||
_mstats.nrcopy++;
|
||||
#endif
|
||||
|
||||
/* If we are using mmap and have mremap, we could use it here. */
|
||||
|
||||
if ((m = internal_malloc (n, file, line, MALLOC_INTERNAL|MALLOC_NOTRACE|MALLOC_NOREG)) == 0)
|
||||
return 0;
|
||||
FASTCOPY (mem, m, tocopy);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
|
||||
/* This needs to change if the definition in malloc.c changes */
|
||||
#ifndef NBUCKETS
|
||||
# define NBUCKETS 30
|
||||
#endif
|
||||
@@ -77,6 +78,8 @@ struct _malstats {
|
||||
int nsplit[NBUCKETS];
|
||||
int tbcoalesce;
|
||||
int ncoalesce[NBUCKETS];
|
||||
int nmmap;
|
||||
bits32_t tmmap;
|
||||
};
|
||||
|
||||
/* Return statistics describing allocation of blocks of size BLOCKSIZE.
|
||||
@@ -98,6 +101,7 @@ struct bucket_stats {
|
||||
int nlesscore;
|
||||
int nsplit;
|
||||
int ncoalesce;
|
||||
int nmmap; /* currently unused */
|
||||
};
|
||||
|
||||
extern struct bucket_stats malloc_bucket_stats __P((int));
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
|
||||
extern int malloc_free_blocks __P((int));
|
||||
|
||||
extern int malloc_mmap_threshold;
|
||||
|
||||
extern struct _malstats _mstats;
|
||||
|
||||
extern FILE *_imalloc_fopen __P((char *, char *, char *, char *, size_t));
|
||||
@@ -103,6 +105,10 @@ _print_malloc_stats (s, fp)
|
||||
for (i = totused = totfree = 0; i < NBUCKETS; i++)
|
||||
{
|
||||
v = malloc_bucket_stats (i);
|
||||
/* Show where the mmap threshold is; sizes greater than this use mmap to
|
||||
allocate and munmap to free (munmap shows up as lesscore). */
|
||||
if (i == malloc_mmap_threshold+1)
|
||||
fprintf (fp, "--------\n");
|
||||
if (v.nmal > 0)
|
||||
fprintf (fp, "%8lu\t%4d\t%6d\t%5d\t%8d\t%8d %5d %8d\n", (unsigned long)v.blocksize, v.nfree, v.nused, v.nmal, v.nmorecore, v.nlesscore, v.nsplit, v.ncoalesce);
|
||||
totfree += v.nfree * v.blocksize;
|
||||
@@ -115,6 +121,8 @@ _print_malloc_stats (s, fp)
|
||||
_mstats.nmal, _mstats.nfre, _mstats.nrealloc, _mstats.nrcopy);
|
||||
fprintf (fp, "Total sbrks: %d, total bytes via sbrk: %d\n",
|
||||
_mstats.nsbrk, _mstats.tsbrk);
|
||||
fprintf (fp, "Total mmaps: %d, total bytes via mmap: %d\n",
|
||||
_mstats.nmmap, _mstats.tmmap);
|
||||
fprintf (fp, "Total blocks split: %d, total block coalesces: %d\n",
|
||||
_mstats.tbsplit, _mstats.tbcoalesce);
|
||||
}
|
||||
|
||||
@@ -846,12 +846,16 @@ Return the function invoked by @var{keyseq} in keymap @var{map}.
|
||||
If @var{map} is @code{NULL}, the current keymap is used. If @var{type} is
|
||||
not @code{NULL}, the type of the object is returned in the @code{int} variable
|
||||
it points to (one of @code{ISFUNC}, @code{ISKMAP}, or @code{ISMACR}).
|
||||
It takes a "translated" key sequence and should not be used if the key sequence
|
||||
can include NUL.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {rl_command_func_t *} rl_function_of_keyseq_len (const char *keyseq, size_t len Keymap map, int *type)
|
||||
@deftypefun {rl_command_func_t *} rl_function_of_keyseq_len (const char *keyseq, size_t len, Keymap map, int *type)
|
||||
Return the function invoked by @var{keyseq} of length @var{len}
|
||||
in keymap @var{map}. Equivalent to @code{rl_function_of_keyseq} with the
|
||||
addition of the @var{len} parameter.
|
||||
It takes a "translated" key sequence and should be used if the key sequence
|
||||
can include NUL.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char **} rl_invoking_keyseqs (rl_command_func_t *function)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
+26
-3
@@ -229,7 +229,9 @@ static SHELL_VAR *get_dirstack __P((SHELL_VAR *));
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
static SHELL_VAR *get_groupset __P((SHELL_VAR *));
|
||||
|
||||
# if defined (DEBUGGER)
|
||||
static SHELL_VAR *get_bashargcv __P((SHELL_VAR *));
|
||||
# endif
|
||||
static SHELL_VAR *build_hashcmd __P((SHELL_VAR *));
|
||||
static SHELL_VAR *get_hashcmd __P((SHELL_VAR *));
|
||||
static SHELL_VAR *assign_hashcmd __P((SHELL_VAR *, char *, arrayind_t, char *));
|
||||
@@ -1652,6 +1654,27 @@ get_groupset (self)
|
||||
return (self);
|
||||
}
|
||||
|
||||
# if defined (DEBUGGER)
|
||||
static SHELL_VAR *
|
||||
get_bashargcv (self)
|
||||
SHELL_VAR *self;
|
||||
{
|
||||
static int self_semaphore = 0;
|
||||
|
||||
/* Backwards compatibility: if we refer to BASH_ARGV or BASH_ARGC at the
|
||||
top level without enabling debug mode, and we don't have an instance
|
||||
of the variable set, initialize the arg arrays.
|
||||
This will already have been done if debugging_mode != 0. */
|
||||
if (self_semaphore == 0 && variable_context == 0 && debugging_mode == 0) /* don't do it for shell functions */
|
||||
{
|
||||
self_semaphore = 1;
|
||||
init_bash_argv ();
|
||||
self_semaphore = 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
# endif
|
||||
|
||||
static SHELL_VAR *
|
||||
build_hashcmd (self)
|
||||
SHELL_VAR *self;
|
||||
@@ -1882,8 +1905,8 @@ initialize_dynamic_variables ()
|
||||
v = init_dynamic_array_var ("GROUPS", get_groupset, null_array_assign, att_noassign);
|
||||
|
||||
# if defined (DEBUGGER)
|
||||
v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, att_noassign|att_nounset);
|
||||
v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, att_noassign|att_nounset);
|
||||
v = init_dynamic_array_var ("BASH_ARGC", get_bashargcv, null_array_assign, att_noassign|att_nounset);
|
||||
v = init_dynamic_array_var ("BASH_ARGV", get_bashargcv, null_array_assign, att_noassign|att_nounset);
|
||||
# endif /* DEBUGGER */
|
||||
v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign|att_nounset);
|
||||
v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign|att_nounset);
|
||||
|
||||
Reference in New Issue
Block a user