bash update to 4.4.18
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
diff --git a/execute_cmd.h b/execute_cmd.h
|
||||
--- a/execute_cmd.h
|
||||
+++ b/execute_cmd.h
|
||||
@@ -37,6 +37,9 @@ struct func_array_state
|
||||
};
|
||||
#endif
|
||||
|
||||
+/* Variables delared in execute_cmd.c, used by many other files */
|
||||
+extern int executing_command_builtin;
|
||||
+
|
||||
extern struct fd_bitmap *new_fd_bitmap __P((int));
|
||||
extern void dispose_fd_bitmap __P((struct fd_bitmap *));
|
||||
extern void close_fd_bitmap __P((struct fd_bitmap *));
|
||||
diff --git a/subst.c b/subst.c
|
||||
--- a/subst.c
|
||||
+++ b/subst.c
|
||||
@@ -10676,11 +10676,12 @@ expand_word_list_internal (list, eflags)
|
||||
tint = do_word_assignment (temp_list->word, 0);
|
||||
this_command_name = savecmd;
|
||||
/* Variable assignment errors in non-interactive shells
|
||||
- running in Posix.2 mode cause the shell to exit. */
|
||||
+ running in Posix.2 mode cause the shell to exit, unless
|
||||
+ they are being run by the `command' builtin. */
|
||||
if (tint == 0)
|
||||
{
|
||||
last_command_exit_value = EXECUTION_FAILURE;
|
||||
- if (interactive_shell == 0 && posixly_correct)
|
||||
+ if (interactive_shell == 0 && posixly_correct && executing_command_builtin == 0)
|
||||
exp_jump_to_top_level (FORCE_EOF);
|
||||
else
|
||||
exp_jump_to_top_level (DISCARD);
|
||||
@@ -0,0 +1,18 @@
|
||||
diff --git a/parse.y b/parse.y
|
||||
--- a/parse.y
|
||||
+++ b/parse.y
|
||||
@@ -4011,11 +4011,13 @@ eof_error:
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
}
|
||||
- else
|
||||
+ else if (shellmeta (ch) == 0)
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%.4s', lex_reswdok -> 0", line_number, ret+retind-4);*/
|
||||
}
|
||||
+ else /* can't be in a reserved word any more */
|
||||
+ lex_rwlen = 0;
|
||||
}
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
; /* don't modify LEX_RESWDOK if we're starting a comment */
|
||||
@@ -0,0 +1,203 @@
|
||||
diff --git a/builtins/fc.def b/builtins/fc.def
|
||||
index fe16471..98c53db 100644
|
||||
--- a/builtins/fc.def
|
||||
+++ b/builtins/fc.def
|
||||
@@ -423,6 +423,7 @@ fc_builtin (list)
|
||||
{
|
||||
sh_wrerror ();
|
||||
fclose (stream);
|
||||
+ FREE (fn);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
fclose (stream);
|
||||
diff --git a/execute_cmd.c b/execute_cmd.c
|
||||
index 63a332a..15b5e19 100644
|
||||
--- a/execute_cmd.c
|
||||
+++ b/execute_cmd.c
|
||||
@@ -2196,8 +2196,10 @@ coproc_setvars (cp)
|
||||
if (v == 0)
|
||||
{
|
||||
v = find_variable_nameref_for_create (cp->c_name, 1);
|
||||
- if (v == INVALID_NAMEREF_VALUE)
|
||||
- return;
|
||||
+ if (v == INVALID_NAMEREF_VALUE) {
|
||||
+ free (namevar);
|
||||
+ return;
|
||||
+ }
|
||||
if (v && nameref_p (v))
|
||||
{
|
||||
free (cp->c_name);
|
||||
@@ -2210,6 +2212,7 @@ coproc_setvars (cp)
|
||||
{
|
||||
if (readonly_p (v))
|
||||
err_readonly (cp->c_name);
|
||||
+ free (namevar);
|
||||
return;
|
||||
}
|
||||
if (v == 0)
|
||||
@@ -5528,7 +5531,6 @@ shell_execve (command, args, env)
|
||||
char *interp;
|
||||
int ilen;
|
||||
|
||||
- close (fd);
|
||||
interp = getinterp (sample, sample_len, (int *)NULL);
|
||||
ilen = strlen (interp);
|
||||
errno = i;
|
||||
diff --git a/expr.c b/expr.c
|
||||
index 172964a..5dc57c0 100644
|
||||
--- a/expr.c
|
||||
+++ b/expr.c
|
||||
@@ -207,7 +207,8 @@ static intmax_t exp5 __P((void));
|
||||
static intmax_t exp4 __P((void));
|
||||
static intmax_t expshift __P((void));
|
||||
static intmax_t exp3 __P((void));
|
||||
-static intmax_t exp2 __P((void));
|
||||
+/* Avoid name clash with standard exp2 */
|
||||
+static intmax_t bash_exp2 __P((void));
|
||||
static intmax_t exppower __P((void));
|
||||
static intmax_t exp1 __P((void));
|
||||
static intmax_t exp0 __P((void));
|
||||
@@ -809,14 +810,14 @@ exp3 ()
|
||||
{
|
||||
register intmax_t val1, val2;
|
||||
|
||||
- val1 = exp2 ();
|
||||
+ val1 = bash_exp2 ();
|
||||
|
||||
while ((curtok == PLUS) || (curtok == MINUS))
|
||||
{
|
||||
int op = curtok;
|
||||
|
||||
readtok ();
|
||||
- val2 = exp2 ();
|
||||
+ val2 = bash_exp2 ();
|
||||
|
||||
if (op == PLUS)
|
||||
val1 += val2;
|
||||
@@ -828,7 +829,7 @@ exp3 ()
|
||||
}
|
||||
|
||||
static intmax_t
|
||||
-exp2 ()
|
||||
+bash_exp2 ()
|
||||
{
|
||||
register intmax_t val1, val2;
|
||||
#if defined (HAVE_IMAXDIV)
|
||||
diff --git a/lib/glob/glob.c b/lib/glob/glob.c
|
||||
index 7f6eafe..c018e29 100644
|
||||
--- a/lib/glob/glob.c
|
||||
+++ b/lib/glob/glob.c
|
||||
@@ -576,7 +576,7 @@ glob_vector (pat, dir, flags)
|
||||
register char *nextname, *npat, *subdir;
|
||||
unsigned int count;
|
||||
int lose, skip, ndirs, isdir, sdlen, add_current, patlen;
|
||||
- register char **name_vector;
|
||||
+ register char **name_vector = NULL;
|
||||
register unsigned int i;
|
||||
int mflags; /* Flags passed to strmatch (). */
|
||||
int pflags; /* flags passed to sh_makepath () */
|
||||
@@ -894,7 +894,7 @@ glob_vector (pat, dir, flags)
|
||||
}
|
||||
|
||||
/* Don't call QUIT; here; let higher layers deal with it. */
|
||||
-
|
||||
+ FREE (name_vector);
|
||||
return ((char **)NULL);
|
||||
}
|
||||
|
||||
diff --git a/lib/sh/pathcanon.c b/lib/sh/pathcanon.c
|
||||
index f19bd55..2a565d6 100644
|
||||
--- a/lib/sh/pathcanon.c
|
||||
+++ b/lib/sh/pathcanon.c
|
||||
@@ -227,7 +227,7 @@ sh_canonpath (path, flags)
|
||||
if (result[2] == '\0') /* short-circuit for bare `//' */
|
||||
result[1] = '\0';
|
||||
else
|
||||
- strcpy (result, result + 1);
|
||||
+ memmove(result, result + 1, strlen(result + 1) + 1);
|
||||
}
|
||||
|
||||
return (result);
|
||||
diff --git a/lib/sh/pathphys.c b/lib/sh/pathphys.c
|
||||
index 26016b7..b64c4cd 100644
|
||||
--- a/lib/sh/pathphys.c
|
||||
+++ b/lib/sh/pathphys.c
|
||||
@@ -245,7 +245,7 @@ error:
|
||||
if (result[2] == '\0') /* short-circuit for bare `//' */
|
||||
result[1] = '\0';
|
||||
else
|
||||
- strcpy (result, result + 1);
|
||||
+ memmove(result, result + 1, strlen(result + 1) + 1);
|
||||
}
|
||||
|
||||
return (result);
|
||||
diff --git a/shell.c b/shell.c
|
||||
index b43de50..4aae182 100644
|
||||
--- a/shell.c
|
||||
+++ b/shell.c
|
||||
@@ -1948,8 +1948,10 @@ show_shell_usage (fp, extra)
|
||||
fputs (_("\t-ilrsD or -c command or -O shopt_option\t\t(invocation only)\n"), fp);
|
||||
|
||||
for (i = 0, set_opts = 0; shell_builtins[i].name; i++)
|
||||
- if (STREQ (shell_builtins[i].name, "set"))
|
||||
+ if (STREQ (shell_builtins[i].name, "set")) {
|
||||
set_opts = savestring (shell_builtins[i].short_doc);
|
||||
+ break;
|
||||
+ }
|
||||
if (set_opts)
|
||||
{
|
||||
s = strchr (set_opts, '[');
|
||||
diff --git a/subst.c b/subst.c
|
||||
index 5f3e41e..7574617 100644
|
||||
--- a/subst.c
|
||||
+++ b/subst.c
|
||||
@@ -5182,8 +5182,11 @@ parameter_list_transform (xc, itype, quoted)
|
||||
list = list_rest_of_args ();
|
||||
if (list == 0)
|
||||
return ((char *)NULL);
|
||||
- if (xc == 'A')
|
||||
- return (pos_params_assignment (list, itype, quoted));
|
||||
+ if (xc == 'A') {
|
||||
+ ret = pos_params_assignment (list, itype, quoted);
|
||||
+ dispose_words (list);
|
||||
+ return (ret);
|
||||
+ }
|
||||
ret = list_transform (xc, (SHELL_VAR *)0, list, itype, quoted);
|
||||
dispose_words (list);
|
||||
return (ret);
|
||||
@@ -6813,6 +6816,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, pflags, qdollaratp, hasdolla
|
||||
{
|
||||
report_error (_("%s: invalid indirect expansion"), name);
|
||||
free (vname);
|
||||
+ free (t1);
|
||||
dispose_word (w);
|
||||
return &expand_wdesc_error;
|
||||
}
|
||||
@@ -6820,6 +6824,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, pflags, qdollaratp, hasdolla
|
||||
{
|
||||
report_error (_("%s: invalid variable name"), vname);
|
||||
free (vname);
|
||||
+ free (t1);
|
||||
dispose_word (w);
|
||||
return &expand_wdesc_error;
|
||||
}
|
||||
diff --git a/support/man2html.c b/support/man2html.c
|
||||
index 6ba5061..1d9e376 100644
|
||||
--- a/support/man2html.c
|
||||
+++ b/support/man2html.c
|
||||
@@ -522,6 +522,7 @@ read_man_page(char *filename)
|
||||
man_buf[buf_size] = '\n';
|
||||
man_buf[buf_size + 1] = man_buf[buf_size + 2] = '\0';
|
||||
} else {
|
||||
+ free (man_buf);
|
||||
man_buf = NULL;
|
||||
}
|
||||
fclose(man_stream);
|
||||
@@ -2562,7 +2563,6 @@ scan_request(char *c)
|
||||
h = name;
|
||||
if (stat(h, &stbuf) != -1)
|
||||
l = stbuf.st_size;
|
||||
- buf = stralloc(l + 4);
|
||||
#if NOCGI
|
||||
if (!out_length) {
|
||||
char *t, *s;
|
||||
@@ -0,0 +1,11 @@
|
||||
diff --git a/parse.y b/parse.y
|
||||
index 85f1c4f..9d1cdf8 100644
|
||||
--- a/parse.y
|
||||
+++ b/parse.y
|
||||
@@ -1453,6 +1453,7 @@ yy_readline_get ()
|
||||
old_sigint = (SigHandler *)set_signal_handler (SIGINT, sigint_sighandler);
|
||||
}
|
||||
|
||||
+ sh_unset_nodelay_mode (fileno (rl_instream)); /* just in case */
|
||||
current_readline_line = readline (current_readline_prompt ?
|
||||
current_readline_prompt : "");
|
||||
@@ -0,0 +1,11 @@
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -449,6 +449,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
|
||||
Reference in New Issue
Block a user