Bash-4.1 patchlevel 11

This commit is contained in:
Chet Ramey 2011-11-21 20:57:16 -05:00
commit 30d188c293
12 changed files with 49 additions and 15 deletions

View file

@ -512,7 +512,7 @@ declare_internal (list, local_var)
{
/* let bind_{array,assoc}_variable take care of this. */
if (assoc_p (var))
bind_assoc_variable (var, name, "0", value, aflags);
bind_assoc_variable (var, name, savestring ("0"), value, aflags);
else
bind_array_variable (name, 0, value, aflags);
}

View file

@ -303,6 +303,16 @@ fc_builtin (list)
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
last_hist = i - rh - hist_last_line_added;
/* XXX */
if (i == last_hist && hlist[last_hist] == 0)
while (last_hist >= 0 && hlist[last_hist] == 0)
last_hist--;
if (last_hist < 0)
{
sh_erange ((char *)NULL, _("history specification"));
return (EXECUTION_FAILURE);
}
if (list)
{
histbeg = fc_gethnum (list->word->word, hlist);
@ -465,7 +475,7 @@ fc_gethnum (command, hlist)
HIST_ENTRY **hlist;
{
int sign, n, clen, rh;
register int i, j;
register int i, j, last_hist;
register char *s;
sign = 1;
@ -485,7 +495,15 @@ fc_gethnum (command, hlist)
has been enabled (interactive or not) should use it in the last_hist
calculation as if it were on. */
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
i -= rh + hist_last_line_added;
last_hist = i - rh - hist_last_line_added;
if (i == last_hist && hlist[last_hist] == 0)
while (last_hist >= 0 && hlist[last_hist] == 0)
last_hist--;
if (last_hist < 0)
return (-1);
i = last_hist;
/* No specification defaults to most recent command. */
if (command == NULL)

View file

@ -117,7 +117,7 @@ extern int errno;
else if (have_fieldwidth) \
nw = vflag ? vbprintf (f, fieldwidth, func) : printf (f, fieldwidth, func); \
else if (have_precision) \
nw = vflag ? vbprintf (f, precision, func) : printf (f, fieldwidth, func); \
nw = vflag ? vbprintf (f, precision, func) : printf (f, precision, func); \
else \
nw = vflag ? vbprintf (f, func) : printf (f, func); \
tw += nw; \
@ -172,7 +172,7 @@ extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__
#endif
#if !HAVE_VSNPRINTF
extern int vsnprintf __P((char *, size_t, const char *, ...)) __attribute__((__format__ (printf, 3, 4)));
extern int vsnprintf __P((char *, size_t, const char *, va_list)) __attribute__((__format__ (printf, 3, 0)));
#endif
static void printf_erange __P((char *));

View file

@ -615,14 +615,15 @@ add_char:
if (unbuffered_read == 0)
zsyncfd (fd);
interrupt_immediately--;
terminate_immediately--;
discard_unwind_frame ("read_builtin");
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
assign_vars:
interrupt_immediately--;
terminate_immediately--;
#if defined (ARRAY_VARS)
/* If -a was given, take the string read, break it into a list of words,
an assign them to `arrayname' in turn. */