Skip to content

Commit 30d188c

Browse files
author
Chet Ramey
committed
Bash-4.1 patchlevel 11
1 parent 0001803 commit 30d188c

12 files changed

+49
-15
lines changed

bashline.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ command_word_completion_function (hint_text, state)
16801680
a single match (multiple matches that end up reducing the number of
16811681
characters in the common prefix are bad) will ever be returned on
16821682
regular completion. */
1683-
if (glob_pattern_p (hint))
1683+
if (globpat)
16841684
{
16851685
if (state == 0)
16861686
{

builtins/declare.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ declare_internal (list, local_var)
512512
{
513513
/* let bind_{array,assoc}_variable take care of this. */
514514
if (assoc_p (var))
515-
bind_assoc_variable (var, name, "0", value, aflags);
515+
bind_assoc_variable (var, name, savestring ("0"), value, aflags);
516516
else
517517
bind_array_variable (name, 0, value, aflags);
518518
}

builtins/fc.def

+20-2
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,16 @@ fc_builtin (list)
303303
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
304304
last_hist = i - rh - hist_last_line_added;
305305

306+
/* XXX */
307+
if (i == last_hist && hlist[last_hist] == 0)
308+
while (last_hist >= 0 && hlist[last_hist] == 0)
309+
last_hist--;
310+
if (last_hist < 0)
311+
{
312+
sh_erange ((char *)NULL, _("history specification"));
313+
return (EXECUTION_FAILURE);
314+
}
315+
306316
if (list)
307317
{
308318
histbeg = fc_gethnum (list->word->word, hlist);
@@ -465,7 +475,7 @@ fc_gethnum (command, hlist)
465475
HIST_ENTRY **hlist;
466476
{
467477
int sign, n, clen, rh;
468-
register int i, j;
478+
register int i, j, last_hist;
469479
register char *s;
470480

471481
sign = 1;
@@ -485,7 +495,15 @@ fc_gethnum (command, hlist)
485495
has been enabled (interactive or not) should use it in the last_hist
486496
calculation as if it were on. */
487497
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
488-
i -= rh + hist_last_line_added;
498+
last_hist = i - rh - hist_last_line_added;
499+
500+
if (i == last_hist && hlist[last_hist] == 0)
501+
while (last_hist >= 0 && hlist[last_hist] == 0)
502+
last_hist--;
503+
if (last_hist < 0)
504+
return (-1);
505+
506+
i = last_hist;
489507

490508
/* No specification defaults to most recent command. */
491509
if (command == NULL)

builtins/printf.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ extern int errno;
117117
else if (have_fieldwidth) \
118118
nw = vflag ? vbprintf (f, fieldwidth, func) : printf (f, fieldwidth, func); \
119119
else if (have_precision) \
120-
nw = vflag ? vbprintf (f, precision, func) : printf (f, fieldwidth, func); \
120+
nw = vflag ? vbprintf (f, precision, func) : printf (f, precision, func); \
121121
else \
122122
nw = vflag ? vbprintf (f, func) : printf (f, func); \
123123
tw += nw; \
@@ -172,7 +172,7 @@ extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__
172172
#endif
173173

174174
#if !HAVE_VSNPRINTF
175-
extern int vsnprintf __P((char *, size_t, const char *, ...)) __attribute__((__format__ (printf, 3, 4)));
175+
extern int vsnprintf __P((char *, size_t, const char *, va_list)) __attribute__((__format__ (printf, 3, 0)));
176176
#endif
177177

178178
static void printf_erange __P((char *));

builtins/read.def

+3-2
Original file line numberDiff line numberDiff line change
@@ -615,14 +615,15 @@ add_char:
615615
if (unbuffered_read == 0)
616616
zsyncfd (fd);
617617

618-
interrupt_immediately--;
619-
terminate_immediately--;
620618
discard_unwind_frame ("read_builtin");
621619

622620
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
623621

624622
assign_vars:
625623

624+
interrupt_immediately--;
625+
terminate_immediately--;
626+
626627
#if defined (ARRAY_VARS)
627628
/* If -a was given, take the string read, break it into a list of words,
628629
an assign them to `arrayname' in turn. */

lib/readline/complete.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ rl_filename_completion_function (text, state)
21382138
All other entries except "." and ".." match. */
21392139
if (filename_len == 0)
21402140
{
2141-
if (_rl_match_hidden_files == 0 && HIDDEN_FILE (entry->d_name))
2141+
if (_rl_match_hidden_files == 0 && HIDDEN_FILE (convfn))
21422142
continue;
21432143

21442144
if (convfn[0] != '.' ||
@@ -2219,7 +2219,7 @@ rl_filename_completion_function (text, state)
22192219
temp[dirlen++] = '/';
22202220
}
22212221

2222-
strcpy (temp + dirlen, entry->d_name);
2222+
strcpy (temp + dirlen, convfn);
22232223
}
22242224
else
22252225
temp = savestring (convfn);

parse.y

+1-1
Original file line numberDiff line numberDiff line change
@@ -5152,7 +5152,7 @@ decode_prompt_string (string)
51525152
{
51535153
t = strrchr (t_string, '/');
51545154
if (t)
5155-
strcpy (t_string, t + 1);
5155+
memmove (t_string, t + 1, strlen (t));
51565156
}
51575157
}
51585158
#undef ROOT_PATH

patchlevel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
2626
looks for to find the patch level (for the sccs version string). */
2727

28-
#define PATCHLEVEL 0
28+
#define PATCHLEVEL 11
2929

3030
#endif /* _PATCHLEVEL_H_ */

print_cmd.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ FILE *xtrace_fp = 0;
113113

114114
#define CHECK_XTRACE_FP xtrace_fp = (xtrace_fp ? xtrace_fp : stderr)
115115

116+
#define PRINT_DEFERRED_HEREDOCS(x) \
117+
do { \
118+
if (deferred_heredocs) \
119+
print_deferred_heredocs (x); \
120+
} while (0)
121+
116122
/* Non-zero means the stuff being printed is inside of a function def. */
117123
static int inside_function_def;
118124
static int skip_this_indent;
@@ -560,13 +566,15 @@ print_for_command (for_command)
560566
FOR_COM *for_command;
561567
{
562568
print_for_command_head (for_command);
563-
564569
cprintf (";");
565570
newline ("do\n");
571+
566572
indentation += indentation_amount;
567573
make_command_string_internal (for_command->action);
574+
PRINT_DEFERRED_HEREDOCS ("");
568575
semicolon ();
569576
indentation -= indentation_amount;
577+
570578
newline ("done");
571579
}
572580

sig.c

+3
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,9 @@ set_signal_handler (sig, handler)
655655
act.sa_flags |= SA_INTERRUPT; /* XXX */
656656
else
657657
act.sa_flags |= SA_RESTART; /* XXX */
658+
#else
659+
if (sig == SIGCHLD)
660+
act.sa_flags |= SA_RESTART;
658661
#endif
659662
sigemptyset (&act.sa_mask);
660663
sigemptyset (&oact.sa_mask);

variables.c

+5
Original file line numberDiff line numberDiff line change
@@ -3808,6 +3808,11 @@ push_func_var (data)
38083808

38093809
if (tempvar_p (var) && (posixly_correct || (var->attributes & att_propagate)))
38103810
{
3811+
/* Make sure we have a hash table to store the variable in while it is
3812+
being propagated down to the global variables table. Create one if
3813+
we have to */
3814+
if ((vc_isfuncenv (shell_variables) || vc_istempenv (shell_variables)) && shell_variables->table == 0)
3815+
shell_variables->table = hash_create (0);
38113816
/* XXX - should we set v->context here? */
38123817
v = bind_variable_internal (var->name, value_cell (var), shell_variables->table, 0, 0);
38133818
if (shell_variables == global_variables)

y.tab.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -7481,7 +7481,7 @@ decode_prompt_string (string)
74817481
{
74827482
t = strrchr (t_string, '/');
74837483
if (t)
7484-
strcpy (t_string, t + 1);
7484+
memmove (t_string, t + 1, strlen (t));
74857485
}
74867486
}
74877487
#undef ROOT_PATH
@@ -8243,4 +8243,3 @@ set_line_mbstate ()
82438243
}
82448244
}
82458245
#endif /* HANDLE_MULTIBYTE */
8246-

0 commit comments

Comments
 (0)