From 2ad5056d274638cf68026c10f459ca9dc0e7f776 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Sat, 3 Dec 2011 22:52:10 -0500 Subject: [PATCH] commit bash-20060831 snapshot --- CHANGES | 36 ++++++++++++++++++++++++++++++++++ COMPAT | 4 +++- CWRU/CWRU.chlog | 9 +++++++++ variables.c | 51 ++++++++++++++++++++++++------------------------- 4 files changed, 73 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index 1fb74a7a7..8385acdf8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,39 @@ +This document details the changes between this version, bash-3.2-beta, +and the previous version, bash-3.2-alpha. + +1. Changes to Bash + +a. Changed the lexical analyzer to treat locale-specific blank characters as + white space. + +b. Fixed a bug in command printing to avoid confusion between redirections and + process substitution. + +c. Fixed problems with cross-compiling originating from inherited environment + variables. + +d. Added write error reporting to printf builtin. + +e. Fixed a bug in the variable expansion code that could cause a core dump in + a multi-byte locale. + +f. Fixed a bug that caused substring expansion of a null string to return + incorrect results. + +g. BASH_COMMAND now retains its previous value while executing commands as the + result of a trap, as the documentation states. + +2. Changes to Readline + +a. Fixed a bug with prompt redisplay in a multi-byte locale to avoid redrawing + the prompt and input line multiple times. + +b. Fixed history expansion to not be confused by here-string redirection. + +c. Readline no longer treats read errors by converting them to newlines, as + it does with EOF. This caused partial lines to be returned from readline(). + +------------------------------------------------------------------------------ This document details the changes between this version, bash-3.2-alpha, and the previous version, bash-3.1-release. diff --git a/COMPAT b/COMPAT index 8ea9339b0..c591ede5f 100644 --- a/COMPAT +++ b/COMPAT @@ -201,7 +201,9 @@ bash-2.0 were significant.) Bash-2.x does not support it. 15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME, - HOSTTYPE, MACHTYPE, or OSTYPE variables. + HOSTTYPE, MACHTYPE, or OSTYPE variables. If they appear in the initial + environment, the export attribute will be set, but if bash provides a + default value, they will remain local to the current shell. 16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables to have special behavior if they appear in the initial environment. diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 0f27170e6..063377280 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -13629,3 +13629,12 @@ execute_cmd.c value from the_printed_command_except_trap) only when not running a trap. Rocky says the debugger is ok with this, and this is what his original diffs did + + 8/29 + ---- +variables.c + - change set_if_not to create shell_variables if it is NULL, since + -o invocation options can cause variables to be set before the + environment is scanned + +[bash-3.2-beta frozen] diff --git a/variables.c b/variables.c index fd228b5ee..c23732650 100644 --- a/variables.c +++ b/variables.c @@ -155,6 +155,8 @@ int array_needs_making = 1; int shell_level = 0; /* Some forward declarations. */ +static void create_variable_tables __P((void)); + static void set_machine_vars __P((void)); static void set_home_var __P((void)); static void set_shell_var __P((void)); @@ -252,19 +254,10 @@ static void push_func_var __P((PTR_T)); static void push_exported_var __P((PTR_T)); static inline int find_special_var __P((const char *)); - -/* Initialize the shell variables from the current environment. - If PRIVMODE is nonzero, don't import functions from ENV or - parse $SHELLOPTS. */ -void -initialize_shell_variables (env, privmode) - char **env; - int privmode; -{ - char *name, *string, *temp_string; - int c, char_index, string_index, string_length; - SHELL_VAR *temp_var; +static void +create_variable_tables () +{ if (shell_variables == 0) { shell_variables = global_variables = new_var_context ((char *)NULL, 0); @@ -279,6 +272,21 @@ initialize_shell_variables (env, privmode) if (shell_function_defs == 0) shell_function_defs = hash_create (0); #endif +} + +/* Initialize the shell variables from the current environment. + If PRIVMODE is nonzero, don't import functions from ENV or + parse $SHELLOPTS. */ +void +initialize_shell_variables (env, privmode) + char **env; + int privmode; +{ + char *name, *string, *temp_string; + int c, char_index, string_index, string_length; + SHELL_VAR *temp_var; + + create_variable_tables (); for (string_index = 0; string = env[string_index++]; ) { @@ -362,11 +370,7 @@ initialize_shell_variables (env, privmode) set_pwd (); /* Set up initial value of $_ */ -#if 0 - temp_var = bind_variable ("_", dollar_vars[0], 0); -#else temp_var = set_if_not ("_", dollar_vars[0]); -#endif /* Remember this pid. */ dollar_dollar_pid = getpid (); @@ -1626,6 +1630,9 @@ set_if_not (name, value) { SHELL_VAR *v; + if (shell_variables == 0) + create_variable_tables (); + v = find_variable (name); if (v == 0) v = bind_variable_internal (name, value, global_variables->table, HASH_NOSRCH, 0); @@ -1768,11 +1775,7 @@ make_new_variable (name, table) /* Make sure we have a shell_variables hash table to add to. */ if (shell_variables == 0) - { - shell_variables = global_variables = new_var_context ((char *)NULL, 0); - shell_variables->scope = 0; - shell_variables->table = hash_create (0); - } + create_variable_tables (); elt = hash_insert (savestring (name), table, HASH_NOSRCH); elt->data = (PTR_T)entry; @@ -1940,11 +1943,7 @@ bind_variable (name, value, flags) VAR_CONTEXT *vc; if (shell_variables == 0) - { - shell_variables = global_variables = new_var_context ((char *)NULL, 0); - shell_variables->scope = 0; - shell_variables->table = hash_create (0); - } + create_variable_tables (); /* If we have a temporary environment, look there first for the variable, and, if found, modify the value there before modifying it in the -- 2.47.3