- print_portable_hash_info: single-quote pathnames and hashed filenames
that contain shell metacharacters. Fixes bug reported by
<g1pi@libero.it> in debian bash bug #739853
+
+ 4/23
+ ----
+{bashhist,bashline}.c
+builtins{bind,help,type}.def
+lib/glob/glob.c, lib/intl/{loadmsgcat,localealias}.c,lib/sh/mktime.c
+ - fixes to memory leaks uncovered by coverity scan
+
+ 4/24
+ ----
+{bashhist,subst,redir,assoc,jobs,array,trap}.c
+lib/intl/l10flist.c
+builtins/complete.def
+ - fixes to memory leaks and other resource usage problems uncovered by
+ coverity scan
+
+redir.c
+ - do_redirection_internal: if dup2 fails (presumably because of a
+ resource limit), close the file descriptor we opened before returning
+ error
+
+ 4/25
+ ----
+config-top.h
+ - DEFAULT_BASHRC: new define with the name of the default shell
+ startup file
+
+bashline.c
+ - bash_directory_completion_matches: don't dequote the directory name.
+ If rl_completion_found_quote is non-zero, readline will dequote the
+ filename itself. Fixes bug reported by Clark Wang
+ <dearvoid@gmail.com>
+
+ 4/27
+ ----
+subst.c
+ - parameter_brace_expand_indir: if parameter_brace_find_indir returns
+ NULL or "", report an error and return &expand_param_error so the
+ error can propagate up
+ - parameter_brace_expand_rhs: if parameter_brace_find_indir returns
+ NULL or "", or if it returns something that is not a valid identifier,
+ report an error and return &expand_wdesc_error so the error can
+ propagate up. Fixes bug reported by Andre Holzhey
+ <andre.holzhey@gmx.de>
arguments separated by spaces and don't do word splitting. Fixes
bug reported by Greg Wooledge <wooledg@eeg.ccf.org> from an IRC
discussion
+
+builtins/hash.def
+ - print_portable_hash_info: single-quote pathnames and hashed filenames
+ that contain shell metacharacters. Fixes bug reported by
+ <g1pi@libero.it> in debian bash bug #739853
+
+ 4/23
+ ----
+{bashhist,bashline}.c
+builtins{bind,help,type}.def
+lib/glob/glob.c, lib/intl/{loadmsgcat,localealias}.c,lib/sh/mktime.c
+ - fixes to memory leaks uncovered by coverity scan
+
+ 4/24
+ ----
+{bashhist,subst,redir,assoc,jobs,array,trap}.c
+lib/intl/l10flist.c
+builtins/complete.def
+ - fixes to memory leaks and other resource usage problems uncovered by
+ coverity scan
+
+redir.c
+ - do_redirection_internal: if dup2 fails (presumably because of a
+ resource limit), close the file descriptor we opened before returning
+ error
+
+ 4/25
+ ----
+config-top.h
+ - DEFAULT_BASHRC: new define with the name of the default shell
+ startup file
+
+bashline.c
+ - bash_directory_completion_matches: don't dequote the directory name.
+ If rl_completion_found_quote is non-zero, readline will dequote the
+ filename itself. Fixes bug reported by Clark Wang
+ <dearvoid@gmail.com>
rsize, rsize);
strcpy(result + rlen, t);
rlen += reg;
- if (quoted && t)
+ if (quoted)
free(t);
/*
* Add a separator only after non-null elements.
for (i = 1; l && i < start; i++)
l = l->next;
if (l == 0)
- return ((char *)NULL);
+ {
+ dispose_words (save);
+ return ((char *)NULL);
+ }
for (j = 0,h = t = l; l && j < nelem; j++)
{
t = l;
int qc;
qc = rl_dispatching ? rl_completion_quote_character : 0;
- dfn = bash_dequote_filename ((char *)text, qc);
+ /* If rl_completion_found_quote != 0, rl_completion_matches will call the
+ filename dequoting function, causing the directory name to be dequoted
+ twice. */
+ if (rl_dispatching && rl_completion_found_quote == 0)
+ dfn = bash_dequote_filename ((char *)text, qc);
+ else
+ dfn = (char *)text;
m1 = rl_completion_matches (dfn, rl_filename_completion_function);
- free (dfn);
+ if (dfn != text)
+ free (dfn);
if (m1 == 0 || m1[0] == 0)
return m1;
pcomp_set_compspec_options (cs, opts_off, 0);
}
+ if (wl)
+ dispose_words (wl);
+
return (ret);
}
reply to the select query is an empty line. */
#define KSH_COMPATIBLE_SELECT
+/* Default interactive shell startup file. */
+#define DEFAULT_BASHRC "~/.bashrc"
+
/* System-wide .bashrc file for interactive shells. */
/* #define SYS_BASHRC "/etc/bash.bashrc" */
{
shell_pgrp = getpid ();
setpgid (0, shell_pgrp);
- tcsetpgrp (shell_tty, shell_pgrp);
+ if (shell_tty != -1)
+ tcsetpgrp (shell_tty, shell_pgrp);
}
while ((terminal_pgrp = tcgetpgrp (shell_tty)) != -1)
+ (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
* sizeof (struct loaded_l10nfile *)));
if (retval == NULL)
- return NULL;
+ {
+ free (abs_filename);
+ return NULL;
+ }
retval->filename = abs_filename;
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 0
+#define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */
may need to be reconsidered later. */
if ((fd2 = dup (fd)) < 0 || (fp = fdopen (fd2, "w")) == NULL)
{
+ old = errno;
if (fd2 >= 0)
close (fd2);
+ dispose_words (tlist);
+ errno = old;
return (errno);
}
errno = 0;
}
}
else if ((fd != redirector) && (dup2 (fd, redirector) < 0))
- return (errno);
+ {
+ close (fd); /* dup2 failed? must be fd limit issue */
+ return (errno);
+ }
#if defined (BUFFERED_INPUT)
/* Do not change the buffered stream for an implicit redirection
#endif
/* The name of the .(shell)rc file. */
-static char *bashrc_file = "~/.bashrc";
+static char *bashrc_file = DEFAULT_BASHRC;
/* Non-zero means to act more like the Bourne shell on startup. */
static int act_like_sh;
/* Ensure that the default startup file is used. (Except that we don't
execute this file for reinitialized shells). */
- bashrc_file = "~/.bashrc";
+ bashrc_file = DEFAULT_BASHRC;
/* Delete all variables and functions. They will be reinitialized when
the environment is parsed. */
for (i = start ? 1 : 0; params && i < start; i++)
params = params->next;
if (params == 0)
- return ((char *)NULL);
+ {
+ dispose_words (save);
+ return ((char *)NULL);
+ }
for (h = t = params; params && i < end; i++)
{
t = params;
}
t = parameter_brace_find_indir (name, var_is_special, quoted, 0);
+ if (t == 0 || *t == 0)
+ {
+ report_error (_("%s: invalid indirect expansion"), name);
+ w = alloc_word_desc ();
+ w->word = &expand_param_error;
+ w->flags = 0;
+ return w;
+ }
chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at);
if (t == 0)
{
WORD_DESC *w;
WORD_LIST *l;
- char *t, *t1, *temp;
+ char *t, *t1, *temp, *vname;
int hasdol;
/* If the entire expression is between double quotes, we want to treat
t = temp ? savestring (temp) : savestring ("");
t1 = dequote_string (t);
free (t);
+
+ /* bash-4.4/5.0 */
+ vname = name;
+ if (*name == '!' &&
+ (legal_variable_starter ((unsigned char)name[1]) || DIGIT (name[1]) || VALID_INDIR_PARAM (name[1])))
+ {
+ vname = parameter_brace_find_indir (name + 1, SPECIAL_VAR (name, 1), quoted, 1);
+ if (vname == 0 || *vname == 0)
+ {
+ report_error (_("%s: invalid indirect expansion"), name);
+ free (vname);
+ dispose_word (w);
+ return &expand_wdesc_error;
+ }
+ if (legal_identifier (vname) == 0)
+ {
+ report_error (_("%s: invalid variable name"), vname);
+ free (vname);
+ dispose_word (w);
+ return &expand_wdesc_error;
+ }
+ }
+
#if defined (ARRAY_VARS)
- if (valid_array_reference (name))
- assign_array_element (name, t1, 0);
+ if (valid_array_reference (vname))
+ assign_array_element (vname, t1, 0);
else
#endif /* ARRAY_VARS */
- bind_variable (name, t1, 0);
+ bind_variable (vname, t1, 0);
#if 0
- if (STREQ (name, "IFS") == 0)
+ if (STREQ (vname, "IFS") == 0)
#endif
- stupidly_hack_special_variables (name);
+ stupidly_hack_special_variables (vname);
+
+ if (vname != name)
+ free (vname);
/* From Posix group discussion Feb-March 2010. Issue 7 0000221 */
free (temp);
|| VALID_INDIR_PARAM (varname[1]));
if (want_indir)
vname = parameter_brace_find_indir (varname+1, SPECIAL_VAR (varname, 1), quoted, 1);
+ /* XXX - what if vname == 0 || *vname == 0 ? */
else
vname = varname;
for (i = start ? 1 : 0; params && i < start; i++)
params = params->next;
if (params == 0)
- return ((char *)NULL);
+ {
+ dispose_words (save);
+ return ((char *)NULL);
+ }
for (h = t = params; params && i < end; i++)
{
t = params;
char *temp, *tt;
intmax_t arg_index;
SHELL_VAR *var;
- int atype, rflags, contains_dollar_at, quoted_dollar_at;
+ int atype, rflags;
arrayind_t ind;
ret = 0;
tt[sindex = 0] = '$';
strcpy (tt + 1, name);
- ret = param_expand (tt, &sindex, quoted, (int *)NULL, &contains_dollar_at,
- "ed_dollar_at, (int *)NULL, pflags);
+ ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
+ (int *)NULL, (int *)NULL, pflags);
free (tt);
}
#if defined (ARRAY_VARS)
}
t = parameter_brace_find_indir (name, var_is_special, quoted, 0);
+ if (t == 0 || *t == 0)
+ {
+ report_error (_("%s: invalid indirect expansion"), name);
+ w = alloc_word_desc ();
+ w->word = &expand_param_error;
+ w->flags = 0;
+ return w;
+ }
chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at);
if (t == 0)
{
WORD_DESC *w;
WORD_LIST *l;
- char *t, *t1, *temp;
+ char *t, *t1, *temp, *vname;
int hasdol;
/* If the entire expression is between double quotes, we want to treat
t = temp ? savestring (temp) : savestring ("");
t1 = dequote_string (t);
free (t);
+
+ /* bash-4.4/5.0 */
+ vname = name;
+ if (*name == '!' &&
+ (legal_variable_starter ((unsigned char)name[1]) || DIGIT (name[1]) || VALID_INDIR_PARAM (name[1])))
+ {
+ vname = parameter_brace_find_indir (name + 1, SPECIAL_VAR (name, 1), quoted, 1);
+ if (vname == 0 || *vname == 0)
+ {
+ report_error (_("%s: invalid indirect expansion"), name);
+ free (vname);
+ dispose_word (w);
+ return &expand_wdesc_error;
+ }
+ if (legal_identifier (vname) == 0)
+ {
+ report_error (_("%s: invalid variable name"), vname);
+ free (vname);
+ dispose_word (w);
+ return &expand_wdesc_error;
+ }
+ }
+
#if defined (ARRAY_VARS)
- if (valid_array_reference (name))
- assign_array_element (name, t1, 0);
+ if (valid_array_reference (vname))
+ assign_array_element (vname, t1, 0);
else
#endif /* ARRAY_VARS */
- bind_variable (name, t1, 0);
+ bind_variable (vname, t1, 0);
#if 0
- if (STREQ (name, "IFS") == 0)
+ if (STREQ (vname, "IFS") == 0)
#endif
- stupidly_hack_special_variables (name);
+ stupidly_hack_special_variables (vname);
+
+ if (vname != name)
+ free (vname);
/* From Posix group discussion Feb-March 2010. Issue 7 0000221 */
free (temp);
-BUILD_DIR=/usr/local/build/bash/bash-current
+BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
retval = trap_saved_exit_value;
running_trap = 0;
+ array_dispose (ps);
+
return retval;
}