mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 07:43:07 +02:00
commit bash-20090702 snapshot
This commit is contained in:
@@ -8170,3 +8170,30 @@ lib/sh/getcwd.c
|
||||
configure.in
|
||||
- add -D_ALL_SOURCE to interix CFLAGS for struct timezone definition.
|
||||
Bug and fix from John Gatewood Ham <uraphalinuxserver@gmail.com>
|
||||
|
||||
6/29
|
||||
----
|
||||
variables.c
|
||||
- change initialize_shell_variables to add environment variables with
|
||||
invalid names to the variables hash table, but marking them as
|
||||
invisible and imported
|
||||
- new function, export_environment_candidate. Used when creating the
|
||||
export environment for commands to include variables with invalid
|
||||
names inherited from the initial environment. Apparently this
|
||||
behavior is widespread
|
||||
- change make_var_export_array to use export_environment_candidate
|
||||
rather than visible_and_exported to test variables for inclusion
|
||||
in the export environment
|
||||
|
||||
7/1
|
||||
---
|
||||
builtins/read.def
|
||||
- fix a memory leak where the number of fields is not the same as
|
||||
the number of variables passed to `read'. Bug report from
|
||||
werner@suse.de
|
||||
|
||||
builtins/command.def
|
||||
- move section of code that sets PATH from -p option before the
|
||||
verbose-handling section, so command -v and command -V honor
|
||||
the PATH set by command -p. Bug and fix from
|
||||
ohki@gssm.otsuka.tsukuba.ac.jp
|
||||
|
||||
+31
-26
@@ -100,6 +100,31 @@ command_builtin (list)
|
||||
if (list == 0)
|
||||
return (EXECUTION_SUCCESS);
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
if (use_standard_path && restricted)
|
||||
{
|
||||
sh_restricted ("-p");
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
begin_unwind_frame ("command_builtin");
|
||||
|
||||
if (use_standard_path)
|
||||
{
|
||||
old_path = get_string_value ("PATH");
|
||||
/* If old_path is NULL, $PATH is unset. If so, we want to make sure
|
||||
it's unset after this command completes. */
|
||||
if (old_path)
|
||||
old_path = savestring (old_path);
|
||||
add_unwind_protect ((Function *)restore_path, old_path);
|
||||
|
||||
standard_path = get_standard_path ();
|
||||
bind_variable ("PATH", standard_path ? standard_path : "", 0);
|
||||
stupidly_hack_special_variables ("PATH");
|
||||
FREE (standard_path);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
int found, any_found;
|
||||
@@ -113,37 +138,15 @@ command_builtin (list)
|
||||
|
||||
any_found += found;
|
||||
}
|
||||
|
||||
run_unwind_frame ("command_builtin");
|
||||
return (any_found ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
if (use_standard_path && restricted)
|
||||
{
|
||||
sh_restricted ("-p");
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
begin_unwind_frame ("command_builtin");
|
||||
|
||||
/* We don't want this to be reparsed (consider command echo 'foo &'), so
|
||||
just make a simple_command structure and call execute_command with it. */
|
||||
if (use_standard_path)
|
||||
{
|
||||
old_path = get_string_value ("PATH");
|
||||
/* If old_path is NULL, $PATH is unset. If so, we want to make sure
|
||||
it's unset after this command completes. */
|
||||
if (old_path)
|
||||
old_path = savestring (old_path);
|
||||
add_unwind_protect ((Function *)restore_path, old_path);
|
||||
|
||||
standard_path = get_standard_path ();
|
||||
bind_variable ("PATH", standard_path ? standard_path : "", 0);
|
||||
FREE (standard_path);
|
||||
}
|
||||
|
||||
#define COMMAND_BUILTIN_FLAGS (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION | CMD_COMMAND_BUILTIN)
|
||||
|
||||
/* We don't want this to be reparsed (consider command echo 'foo &'), so
|
||||
just make a simple_command structure and call execute_command with it. */
|
||||
command = make_bare_simple_command ();
|
||||
command->value.Simple->words = (WORD_LIST *)copy_word_list (list);
|
||||
command->value.Simple->redirects = (REDIRECT *)NULL;
|
||||
@@ -182,6 +185,8 @@ restore_path (var)
|
||||
}
|
||||
else
|
||||
unbind_variable ("PATH");
|
||||
|
||||
stupidly_hack_special_variables ("PATH");
|
||||
}
|
||||
|
||||
/* Return a value for PATH that is guaranteed to find all of the standard
|
||||
|
||||
+4
-1
@@ -763,7 +763,10 @@ assign_vars:
|
||||
if (*input_string == 0)
|
||||
tofree = input_string = t;
|
||||
else
|
||||
input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape);
|
||||
{
|
||||
input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape);
|
||||
tofree = t;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+24
-2
@@ -254,6 +254,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)
|
||||
@@ -377,10 +378,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;
|
||||
}
|
||||
|
||||
@@ -3089,6 +3097,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
|
||||
@@ -3445,7 +3463,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;
|
||||
@@ -3594,7 +3616,7 @@ maybe_make_export_env ()
|
||||
}
|
||||
export_env[export_env_index = 0] = (char *)NULL;
|
||||
|
||||
/* Make a dummy variable context from the temporary_env, stick it on
|
||||
/* Make a dummy variable context from the temporary_env, stick it on
|
||||
the front of shell_variables, call make_var_export_array on the
|
||||
whole thing to flatten it, and convert the list of SHELL_VAR *s
|
||||
to the form needed by the environment. */
|
||||
|
||||
Reference in New Issue
Block a user