commit bash-20170601 snapshot

This commit is contained in:
Chet Ramey
2017-06-07 15:30:55 -04:00
parent 1110e30870
commit b90cb5a280
7 changed files with 50 additions and 7 deletions
+20
View File
@@ -14000,3 +14000,23 @@ builtins/read.def
- read_builtin: if -n or -N option is supplied with a 0 argument,
don't attempt to read any characters; bail out right away. Reported
by Eduardo Bustamante <dualbus@gmail.com>, relaying from IRC
6/3
---
config.h.in
- HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC: add define, used by stat-time.h
to construct a timespec from struct stat. Report and fix from
Siteshwar Vashisht <svashisht@redhat.com>
variables.h
- att_regenerate: new internal variable attribute: if set, regenerate
dynamic variable's value when it's exported and we are creating the
export environment
variables.c
- init_dynamic_variables: LINENO, EPOCHSECONDS, EPOCHREALTIME: set
internal regenerate attribute for these dynamic variables
- make_env_array_from_var_list: if a dynamic variable has the
regenerate attribute set, call the dynamic value function to generate
an updated value before placing it in the environment. From a report
about exporting LINENO from by Robert Elz <kre@bmunnari.OZ.AU>
+1
View File
@@ -452,6 +452,7 @@
#undef SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
#undef PTHREAD_H_DEFINES_STRUCT_TIMESPEC
#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
#undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC
#undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
+1 -1
View File
@@ -6837,7 +6837,7 @@ If \fBHISTFILESIZE\fP is unset, or set to null, a non-numeric value,
or a numeric value less than zero, the history file is not truncated.
When the history file is read,
lines beginning with the history comment character followed immediately
by a digit are interpreted as timestamps for the preceding history line.
by a digit are interpreted as timestamps for the following history line.
These timestamps are optionally displayed depending on the value of the
.SM
.B HISTTIMEFORMAT
+14 -4
View File
@@ -384,7 +384,7 @@ BRACKMATCH (p, test, flags)
{
register CHAR cstart, cend, c;
register int not; /* Nonzero if the sense of the character class is inverted. */
int brcnt, forcecoll;
int brcnt, brchr, forcecoll;
INT pc;
CHAR *savep;
U_CHAR orig_test;
@@ -460,7 +460,7 @@ BRACKMATCH (p, test, flags)
if (pc == -1)
pc = 0;
else
p = close + 2;
p = close + 2; /* move past the closing `]' */
free (ccname);
}
@@ -577,16 +577,26 @@ matched:
/* Skip the rest of the [...] that already matched. */
c = *--p;
brcnt = 1;
brchr = 0;
while (brcnt > 0)
{
int oc;
/* A `[' without a matching `]' is just another character to match. */
if (c == L('\0'))
return ((test == L('[')) ? savep : (CHAR *)0);
oc = c;
c = *p++;
if (c == L('[') && (*p == L('=') || *p == L(':') || *p == L('.')))
brcnt++;
else if (c == L(']'))
{
brcnt++;
brchr = *p;
}
/* we only want to check brchr if we set it above */
else if (c == L(']') && brcnt > 1 && brchr != 0 && oc == brchr)
brcnt--;
else if (c == L(']') && brcnt == 1)
brcnt--;
else if (!(flags & FNM_NOESCAPE) && c == L('\\'))
{
+1 -1
View File
@@ -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
+11 -1
View File
@@ -1825,13 +1825,15 @@ initialize_dynamic_variables ()
INIT_DYNAMIC_VAR ("RANDOM", (char *)NULL, get_random, assign_random);
VSETATTR (v, att_integer);
INIT_DYNAMIC_VAR ("LINENO", (char *)NULL, get_lineno, assign_lineno);
VSETATTR (v, att_integer);
VSETATTR (v, att_integer|att_regenerate);
INIT_DYNAMIC_VAR ("BASHPID", (char *)NULL, get_bashpid, null_assign);
VSETATTR (v, att_integer);
INIT_DYNAMIC_VAR ("EPOCHSECONDS", (char *)NULL, get_epochseconds, null_assign);
VSETATTR (v, att_regenerate);
INIT_DYNAMIC_VAR ("EPOCHREALTIME", (char *)NULL, get_epochrealtime, null_assign);
VSETATTR (v, att_regenerate);
#if defined (HISTORY)
INIT_DYNAMIC_VAR ("HISTCMD", (char *)NULL, get_histcmd, (sh_var_assign_func_t *)NULL);
@@ -4449,6 +4451,14 @@ make_env_array_from_var_list (vars)
/* We don't use the exportstr stuff on Cygwin at all. */
INVALIDATE_EXPORTSTR (var);
#endif
/* If the value is generated dynamically, generate it here. */
if (regen_p (var) && var->dynamic_value)
{
var = (*(var->dynamic_value)) (var);
INVALIDATE_EXPORTSTR (var);
}
if (var->exportstr)
value = var->exportstr;
else if (function_p (var))
+2
View File
@@ -125,6 +125,7 @@ typedef struct _vlist {
#define att_imported 0x0008000 /* came from environment */
#define att_special 0x0010000 /* requires special handling */
#define att_nofree 0x0020000 /* do not free value on unset */
#define att_regenerate 0x0040000 /* regenerate when exported */
#define attmask_int 0x00ff000
@@ -153,6 +154,7 @@ typedef struct _vlist {
#define imported_p(var) ((((var)->attributes) & (att_imported)))
#define specialvar_p(var) ((((var)->attributes) & (att_special)))
#define nofree_p(var) ((((var)->attributes) & (att_nofree)))
#define regen_p(var) ((((var)->attributes) & (att_regenerate)))
#define tempvar_p(var) ((((var)->attributes) & (att_tempvar)))