Bash-4.0 patchlevel 38

This commit is contained in:
Chet Ramey 2011-11-21 20:49:12 -05:00
commit 89a92869e5
27 changed files with 490 additions and 164 deletions

View file

@ -252,6 +252,7 @@ static SHELL_VAR **fapply __P((sh_var_map_func_t *));
static int visible_var __P((SHELL_VAR *));
static int visible_and_exported __P((SHELL_VAR *));
static int export_environment_candidate __P((SHELL_VAR *));
static int local_and_exported __P((SHELL_VAR *));
static int variable_in_context __P((SHELL_VAR *));
#if defined (ARRAY_VARS)
@ -375,10 +376,17 @@ initialize_shell_variables (env, privmode)
}
# endif
#endif
#if 0
else if (legal_identifier (name))
#else
else
#endif
{
temp_var = bind_variable (name, string, 0);
VSETATTR (temp_var, (att_exported | att_imported));
if (legal_identifier (name))
VSETATTR (temp_var, (att_exported | att_imported));
else
VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
array_needs_making = 1;
}
@ -2209,7 +2217,7 @@ bind_variable_internal (name, value, table, hflags, aflags)
}
else if (assoc_p (entry))
{
assoc_insert (assoc_cell (entry), "0", newval);
assoc_insert (assoc_cell (entry), savestring ("0"), newval);
free (newval);
}
else
@ -3082,6 +3090,16 @@ visible_and_exported (var)
return (invisible_p (var) == 0 && exported_p (var));
}
/* Candidate variables for the export environment are either valid variables
with the export attribute or invalid variables inherited from the initial
environment and simply passed through. */
static int
export_environment_candidate (var)
SHELL_VAR *var;
{
return (exported_p (var) && (invisible_p (var) == 0 || imported_p (var)));
}
/* Return non-zero if VAR is a local variable in the current context and
is exported. */
static int
@ -3438,7 +3456,11 @@ make_var_export_array (vcxt)
char **list;
SHELL_VAR **vars;
#if 0
vars = map_over (visible_and_exported, vcxt);
#else
vars = map_over (export_environment_candidate, vcxt);
#endif
if (vars == 0)
return (char **)NULL;