From b238140076b6a75b0e9419141a4da52fdbd1e3b6 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Sat, 3 Dec 2011 22:52:26 -0500 Subject: [PATCH] commit bash-20060907 snapshot --- CWRU/CWRU.chlog | 15 +++++ CWRU/CWRU.chlog~ | 27 +++++++++ autom4te.cache/output.1 | 2 +- autom4te.cache/requests | 127 +++++++++++++++++++++++++++++++++++++--- braces.c | 12 ++++ braces.c~ | 42 +++++++++---- builtins/echo.def | 3 +- builtins/echo.def~ | 2 + configure | 2 +- configure.in | 2 +- configure.in~ | 5 +- doc/bash.1 | 8 +-- doc/bash.1~ | 17 +++--- doc/bashref.texi | 3 - doc/bashref.texi~ | 9 +-- doc/version.texi | 6 +- doc/version.texi~ | 12 ++-- tests/RUN-ONE-TEST | 2 +- tests/func.right | 2 +- tests/func.tests | 2 +- tests/func.tests~ | 8 +++ variables.c | 5 +- variables.c~ | 67 ++++++++------------- 23 files changed, 278 insertions(+), 102 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 063377280..f74af9352 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -13638,3 +13638,18 @@ variables.c environment is scanned [bash-3.2-beta frozen] + + 9/5 + --- +variables.c + - change dispose_used_env_vars to call maybe_make_export_env + immediately if we're disposing a temporary environment, since + `environ' points to the export environment and getenv() will use + that on systems that don't allow getenv() to be replaced. This + could cause the temporary environment to affect the shell. Bug + reported by Vasco Pedro + +builtins/echo.def,doc/{bash.1,bashref.texi} + - clarify that `echo -e' and echo when the `xpg_echo' shell option is + enabled require the \0 to precede any octal constant to be expanded. + Reported by Vasco Pedro diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index a5f61fbd9..170910088 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -13621,3 +13621,30 @@ aclocal.m4 Makefile.in - switch the TAGS and tags targets so TAGS is the output of `etags' and tags is the output of `ctags'. Suggested by Masatake YAMATO + + 8/25 + ---- +execute_cmd.c + - change code to match documentation: set BASH_COMMAND (which takes its + 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] + + 9/5 + --- +variables.c + - change dispose_used_env_vars to call maybe_make_export_env + immediately if we're disposing a temporary environment, since + `environ' points to the export environment and getenv() will use + that on systems that don't allow getenv() to be replaced. This + could cause the temporary environment to affect the shell. Bug + reported by Vasco Pedro diff --git a/autom4te.cache/output.1 b/autom4te.cache/output.1 index f81a66332..7211abf46 100644 --- a/autom4te.cache/output.1 +++ b/autom4te.cache/output.1 @@ -1693,7 +1693,7 @@ if test "$opt_curses" = yes; then fi if test -z "${DEBUGGER_START_FILE}"; then - DEBUGGER_START_FILE=${ac_default_prefix}/lib/bashdb/bashdb-main.inc + DEBUGGER_START_FILE=${datadir}/bashdb/bashdb-main.inc fi opt_minimal_config=no diff --git a/autom4te.cache/requests b/autom4te.cache/requests index 84e4075e3..1175d795f 100644 --- a/autom4te.cache/requests +++ b/autom4te.cache/requests @@ -17,17 +17,126 @@ { 'm4_pattern_forbid' => 1, 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_TYPE_OFF_T' => 1, 'AC_C_VOLATILE' => 1, + 'AC_FUNC_CLOSEDIR_VOID' => 1, + 'AC_REPLACE_FNMATCH' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_FUNC_STAT' => 1, + 'AC_FUNC_WAIT3' => 1, + 'AC_HEADER_TIME' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AC_FUNC_GETMNTENT' => 1, + 'AC_TYPE_MODE_T' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_CHECK_HEADERS' => 1, + 'AC_FUNC_STRNLEN' => 1, + 'm4_sinclude' => 1, + 'AC_PROG_CXX' => 1, + 'AC_PATH_X' => 1, + 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, + 'AC_PROG_AWK' => 1, + '_m4_warn' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_HEADER_MAJOR' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_FUNC_MBRTOWC' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AC_TYPE_UID_T' => 1, + 'AC_PROG_MAKE_SET' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'm4_pattern_allow' => 1, + 'sinclude' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_FUNC_STRERROR_R' => 1, + 'AC_PROG_CC' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, + 'AC_FUNC_FORK' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AC_PROG_YACC' => 1, + 'AC_INIT' => 1, + 'AC_STRUCT_TIMEZONE' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AC_SUBST' => 1, + 'AC_FUNC_ALLOCA' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_PROG_RANLIB' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'AC_FUNC_MMAP' => 1, + 'AC_FUNC_REALLOC' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_CHECK_TYPES' => 1, + 'AC_CONFIG_LINKS' => 1, + 'AC_CHECK_MEMBERS' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AC_FUNC_UTIME_NULL' => 1, + 'AC_FUNC_SELECT_ARGTYPES' => 1, + 'AC_HEADER_STAT' => 1, + 'AC_FUNC_STRFTIME' => 1, + 'AC_C_INLINE' => 1, + 'AC_PROG_CPP' => 1, + 'AC_C_CONST' => 1, + 'AC_PROG_LEX' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_CONFIG_FILES' => 1, + 'include' => 1, + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_PROG_INSTALL' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_FUNC_OBSTACK' => 1, + 'AC_CHECK_LIB' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_GETGROUPS' => 1, + 'AC_FUNC_GETLOADAVG' => 1, + 'AH_OUTPUT' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_HEADER_SYS_WAIT' => 1, + 'AC_PROG_LN_S' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'm4_include' => 1, + 'AC_HEADER_DIRENT' => 1, + 'AC_CHECK_FUNCS' => 1 + } + ], 'Autom4te::Request' ), + bless( [ + '1', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'aclocal.m4', + 'configure.in' + ], + { + 'm4_pattern_forbid' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, 'AC_TYPE_OFF_T' => 1, + 'AC_C_VOLATILE' => 1, 'AC_FUNC_CLOSEDIR_VOID' => 1, 'AC_REPLACE_FNMATCH' => 1, 'AC_PROG_LIBTOOL' => 1, 'AC_FUNC_STAT' => 1, 'AC_HEADER_TIME' => 1, 'AC_FUNC_WAIT3' => 1, - 'AC_FUNC_LSTAT' => 1, - 'AC_STRUCT_TM' => 1, 'AM_AUTOMAKE_VERSION' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_FUNC_LSTAT' => 1, 'AC_TYPE_MODE_T' => 1, 'AC_FUNC_GETMNTENT' => 1, 'AC_FUNC_STRTOD' => 1, @@ -65,8 +174,8 @@ 'AC_FUNC_CHOWN' => 1, 'AC_SUBST' => 1, 'AC_FUNC_ALLOCA' => 1, - 'AC_FUNC_GETPGRP' => 1, 'AC_CANONICAL_HOST' => 1, + 'AC_FUNC_GETPGRP' => 1, 'AC_PROG_RANLIB' => 1, 'AM_INIT_AUTOMAKE' => 1, 'AC_FUNC_SETPGRP' => 1, @@ -74,35 +183,35 @@ 'AC_FUNC_MMAP' => 1, 'AC_FUNC_REALLOC' => 1, 'AC_TYPE_SIZE_T' => 1, - 'AC_CHECK_TYPES' => 1, 'AC_CONFIG_LINKS' => 1, + 'AC_CHECK_TYPES' => 1, 'AC_CHECK_MEMBERS' => 1, 'AM_MAINTAINER_MODE' => 1, 'AC_FUNC_UTIME_NULL' => 1, 'AC_FUNC_SELECT_ARGTYPES' => 1, 'AC_FUNC_STRFTIME' => 1, 'AC_HEADER_STAT' => 1, - 'AC_PROG_CPP' => 1, 'AC_C_INLINE' => 1, + 'AC_PROG_CPP' => 1, 'AC_TYPE_PID_T' => 1, - 'AC_PROG_LEX' => 1, 'AC_C_CONST' => 1, + 'AC_PROG_LEX' => 1, 'AC_CONFIG_FILES' => 1, 'include' => 1, 'AC_FUNC_SETVBUF_REVERSED' => 1, 'AC_PROG_INSTALL' => 1, 'AM_GNU_GETTEXT' => 1, - 'AC_CHECK_LIB' => 1, 'AC_FUNC_OBSTACK' => 1, + 'AC_CHECK_LIB' => 1, 'AC_FUNC_MALLOC' => 1, 'AC_FUNC_GETGROUPS' => 1, 'AC_FUNC_GETLOADAVG' => 1, 'AH_OUTPUT' => 1, 'AC_FUNC_FSEEKO' => 1, 'AM_PROG_CC_C_O' => 1, - 'AC_FUNC_MKTIME' => 1, - 'AC_CANONICAL_SYSTEM' => 1, 'AM_CONDITIONAL' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AC_FUNC_MKTIME' => 1, 'AC_CONFIG_HEADERS' => 1, 'AC_HEADER_SYS_WAIT' => 1, 'AC_FUNC_MEMCMP' => 1, diff --git a/braces.c b/braces.c index 3f5c5e85f..253739741 100644 --- a/braces.c +++ b/braces.c @@ -71,6 +71,18 @@ static char **mkseq(); static char **array_concat (); #endif +#if 0 +static void +dump_result (a) + char **a; +{ + int i; + + for (i = 0; a[i]; i++) + printf ("dump_result: a[%d] = -%s-\n", i, a[i]); +} +#endif + /* Return an array of strings; the brace expansion of TEXT. */ char ** brace_expand (text) diff --git a/braces.c~ b/braces.c~ index 30c3e385a..c7a2d72e5 100644 --- a/braces.c~ +++ b/braces.c~ @@ -61,7 +61,7 @@ int brace_arg_separator = ','; static int brace_gobbler __P((char *, size_t, int *, int)); static char **expand_amble __P((char *, size_t, int)); static char **expand_seqterm __P((char *, size_t)); -static char **mkseq __P((int, int, int)); +static char **mkseq __P((int, int, int, int)); static char **array_concat __P((char **, char **)); #else static int brace_gobbler (); @@ -71,6 +71,16 @@ static char **mkseq(); static char **array_concat (); #endif +static void +dump_result (a) + char **a; +{ + int i; + + for (i = 0; a[i]; i++) + printf ("dump_result: a[%d] = -%s-\n", i, a[i]); +} + /* Return an array of strings; the brace expansion of TEXT. */ char ** brace_expand (text) @@ -88,7 +98,7 @@ brace_expand (text) /* Find the text of the preamble. */ tlen = strlen (text); i = 0; -#if 1 +#if defined (CSH_BRACE_COMPAT) c = brace_gobbler (text, tlen, &i, '{'); /* } */ #else /* Make sure that when we exit this loop, c == 0 or text[i] begins a @@ -119,8 +129,7 @@ brace_expand (text) break; } while (c); -#endif - +#endif /* !CSH_BRACE_COMPAT */ preamble = (char *)xmalloc (i + 1); strncpy (preamble, text, i); @@ -227,6 +236,8 @@ add_tack: result = array_concat (result, tack); strvec_dispose (tack); +dump_result (result); + return (result); } @@ -292,22 +303,31 @@ expand_amble (text, tlen, flags) #define ST_CHAR 2 static char ** -mkseq (start, end, type) - int start, end, type; +mkseq (start, end, incr, type) + int start, end, incr, type; { - int n, incr, i; + int n, i; char **result, *t; n = abs (end - start) + 1; result = strvec_create (n + 1); - incr = (start < end) ? 1 : -1; + if (incr == 0) + incr = 1; + + if (start > end && incr > 0) + incr = -incr; + else if (start < end && incr < 0) + incr = -incr; /* Make sure we go through the loop at least once, so {3..3} prints `3' */ i = 0; n = start; do { +#if defined (SHELL) + QUIT; /* XXX - memory leak here */ +#endif if (type == ST_INT) result[i++] = itos (n); else @@ -381,7 +401,7 @@ expand_seqterm (text, tlen) rhs_v = tr; } - result = mkseq (lhs_v, rhs_v, lhs_t); + result = mkseq (lhs_v, rhs_v, 1, lhs_t); free (lhs); free (rhs); @@ -413,7 +433,7 @@ brace_gobbler (text, tlen, indx, satisfy) DECLARE_MBSTATE; level = quoted = pass_next = 0; -#if 1 +#if defined (CSH_BRACE_COMPAT) commas = 1; #else commas = (satisfy == '}') ? 0 : 1; @@ -498,7 +518,7 @@ brace_gobbler (text, tlen, indx, satisfy) level++; else if (c == '}' && level) level--; -#if 0 +#if !defined (CSH_BRACE_COMPAT) else if (satisfy == '}' && c == brace_arg_separator && level == 0) commas++; else if (satisfy == '}' && STREQN (text+i, BRACE_SEQ_SPECIFIER, 2) && diff --git a/builtins/echo.def b/builtins/echo.def index 0effc8945..923c43a24 100644 --- a/builtins/echo.def +++ b/builtins/echo.def @@ -50,7 +50,8 @@ following backslash-escaped characters is turned on: \t horizontal tab \v vertical tab \\ backslash - \num the character whose ASCII code is NUM (octal). + \0nnn the character whose ASCII code is NNN (octal). NNN can be + 0 to 3 octal digits You can explicitly turn off the interpretation of the above characters with the -E option. diff --git a/builtins/echo.def~ b/builtins/echo.def~ index 6792659a7..0effc8945 100644 --- a/builtins/echo.def~ +++ b/builtins/echo.def~ @@ -31,6 +31,8 @@ $PRODUCES echo.c #include #include "../shell.h" +#include "common.h" + $BUILTIN echo $FUNCTION echo_builtin $DEPENDS_ON V9_ECHO diff --git a/configure b/configure index de545e10e..ac98f2c4a 100755 --- a/configure +++ b/configure @@ -1693,7 +1693,7 @@ if test "$opt_curses" = yes; then fi if test -z "${DEBUGGER_START_FILE}"; then - DEBUGGER_START_FILE=${ac_default_prefix}/lib/bashdb/bashdb-main.inc + DEBUGGER_START_FILE=${datadir}/bashdb/bashdb-main.inc fi opt_minimal_config=no diff --git a/configure.in b/configure.in index c3681653b..71d85808b 100644 --- a/configure.in +++ b/configure.in @@ -149,7 +149,7 @@ if test "$opt_curses" = yes; then fi if test -z "${DEBUGGER_START_FILE}"; then - DEBUGGER_START_FILE=${ac_default_prefix}/lib/bashdb/bashdb-main.inc + DEBUGGER_START_FILE=${datadir}/bashdb/bashdb-main.inc fi dnl optional shell features in config.h.in diff --git a/configure.in~ b/configure.in~ index cc862da22..c3681653b 100644 --- a/configure.in~ +++ b/configure.in~ @@ -22,10 +22,10 @@ dnl Process this file with autoconf to produce a configure script. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -AC_REVISION([for Bash 3.2, version 3.188])dnl +AC_REVISION([for Bash 3.2, version 3.190])dnl define(bashvers, 3.2) -define(relstatus, devel) +define(relstatus, beta) AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org]) @@ -383,6 +383,7 @@ dnl Note that host and target machine are the same, and different than the dnl build machine. dnl Set SIGNAMES_H based on whether or not we're cross-compiling. +CROSS_COMPILE= if test "x$cross_compiling" = "xyes"; then case "${host}" in *-cygwin*) diff --git a/doc/bash.1 b/doc/bash.1 index 1dcf497ee..105aa6d73 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -6,12 +6,12 @@ .\" Case Western Reserve University .\" chet@po.cwru.edu .\" -.\" Last Change: Thu May 11 14:25:48 EDT 2006 +.\" Last Change: Fri Sep 8 13:43:16 EDT 2006 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2006 May 11" "GNU Bash-3.2" +.TH BASH 1 "2006 September 8" "GNU Bash-3.2" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -6642,10 +6642,6 @@ backslash the eight-bit character whose value is the octal value \fInnn\fP (zero to three octal digits) .TP -.B \e\fInnn\fP -the eight-bit character whose value is the octal value \fInnn\fP -(one to three octal digits) -.TP .B \ex\fIHH\fP the eight-bit character whose value is the hexadecimal value \fIHH\fP (one or two hex digits) diff --git a/doc/bash.1~ b/doc/bash.1~ index baab3772c..1dcf497ee 100644 --- a/doc/bash.1~ +++ b/doc/bash.1~ @@ -6,12 +6,12 @@ .\" Case Western Reserve University .\" chet@po.cwru.edu .\" -.\" Last Change: Thu Jan 26 09:04:43 EST 2006 +.\" Last Change: Thu May 11 14:25:48 EDT 2006 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2006 Jan 26" "GNU Bash-3.2" +.TH BASH 1 "2006 May 11" "GNU Bash-3.2" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -809,10 +809,10 @@ as for pathname expansion (see .B Pathname Expansion below). The \fIword\fP is expanded using tilde -expansion, parameter and variable expansion, arithmetic substituion, +expansion, parameter and variable expansion, arithmetic substitution, command substitution, process substitution and quote removal. Each \fIpattern\fP examined is expanded using tilde -expansion, parameter and variable expansion, arithmetic substituion, +expansion, parameter and variable expansion, arithmetic substitution, command substitution, and process substitution. If the shell option .B nocasematch @@ -1693,7 +1693,8 @@ command history is not saved when an interactive shell exits. .B HISTFILESIZE The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is truncated, if -necessary, to contain no more than that number of lines. The default +necessary, by removing the oldest entries, +to contain no more than that number of lines. The default value is 500. The history file is also truncated to this size after writing it when an interactive shell exits. .TP @@ -8406,8 +8407,8 @@ the command is executed each time a shell function or a script executed with the \fB.\fP or \fBsource\fP builtins finishes executing. Signals ignored upon entry to the shell cannot be trapped or reset. -Trapped signals are reset to their original values in a child -process when it is created. +Trapped signals that are not being ignored are reset to their original +values in a child process when it is created. The return status is false if any .I sigspec is invalid; otherwise @@ -8530,7 +8531,7 @@ The maximum size of a process's data segment The maximum scheduling priority ("nice") .TP .B \-f -The maximum size of files created by the shell +The maximum size of files written by the shell and its children .TP .B \-i The maximum number of pending signals diff --git a/doc/bashref.texi b/doc/bashref.texi index b9a0b6642..e7818a83b 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -3341,9 +3341,6 @@ backslash @item \0@var{nnn} the eight-bit character whose value is the octal value @var{nnn} (zero to three octal digits) -@item \@var{nnn} -the eight-bit character whose value is the octal value @var{nnn} -(one to three octal digits) @item \x@var{HH} the eight-bit character whose value is the hexadecimal value @var{HH} (one or two hex digits) diff --git a/doc/bashref.texi~ b/doc/bashref.texi~ index 25a5d5302..b9a0b6642 100644 --- a/doc/bashref.texi~ +++ b/doc/bashref.texi~ @@ -3030,8 +3030,8 @@ each time a shell function or a script executed with the @code{.} or @code{source} builtins finishes executing. Signals ignored upon entry to the shell cannot be trapped or reset. -Trapped signals are reset to their original values in a child -process when it is created. +Trapped signals that are not being ignored are reset to their original +values in a child process when it is created. The return status is zero unless a @var{sigspec} does not specify a valid signal. @@ -3861,7 +3861,7 @@ The maximum size of a process's data segment. The maximum scheduling priority ("nice"). @item -f -The maximum size of files created by the shell. +The maximum size of files written by the shell and its children. @item -i The maximum number of pending signals. @@ -4543,7 +4543,8 @@ default value is @file{~/.bash_history}. @item HISTFILESIZE The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is truncated, if -necessary, to contain no more than that number of lines. +necessary, by removing the oldest entries, +to contain no more than that number of lines. The history file is also truncated to this size after writing it when an interactive shell exits. The default value is 500. diff --git a/doc/version.texi b/doc/version.texi index 3645f4482..f77c0b605 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,9 +2,9 @@ Copyright (C) 1988-2006 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Thu May 11 14:25:33 EDT 2006 +@set LASTCHANGE Fri Sep 8 13:45:21 EDT 2006 @set EDITION 3.2 @set VERSION 3.2 -@set UPDATED 11 May 2006 -@set UPDATED-MONTH May 2006 +@set UPDATED 8 September 2006 +@set UPDATED-MONTH September 2006 diff --git a/doc/version.texi~ b/doc/version.texi~ index 6ee00d428..3645f4482 100644 --- a/doc/version.texi~ +++ b/doc/version.texi~ @@ -1,10 +1,10 @@ @ignore -Copyright (C) 1988-2005 Free Software Foundation, Inc. +Copyright (C) 1988-2006 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Fri Dec 30 10:50:51 EST 2005 +@set LASTCHANGE Thu May 11 14:25:33 EDT 2006 -@set EDITION 3.1 -@set VERSION 3.1 -@set UPDATED 30 December 2005 -@set UPDATED-MONTH December 2005 +@set EDITION 3.2 +@set VERSION 3.2 +@set UPDATED 11 May 2006 +@set UPDATED-MONTH May 2006 diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 3efcf32d6..72ec06a2c 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/chet/bash/bash-current +BUILD_DIR=/usr/local/build/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR diff --git a/tests/func.right b/tests/func.right index 1bd12e121..e97a4865b 100644 --- a/tests/func.right +++ b/tests/func.right @@ -27,7 +27,7 @@ f1 () return $status } before: try to assign to FUNCNAME -outside: FUNCNAME = +outside: FUNCNAME = main before: FUNCNAME = func FUNCNAME = func2 after: FUNCNAME = func diff --git a/tests/func.tests b/tests/func.tests index cbbbdb035..23dff44be 100644 --- a/tests/func.tests +++ b/tests/func.tests @@ -132,7 +132,7 @@ func() } echo before: try to assign to FUNCNAME -FUCNAME=7 +FUNCNAME=7 echo outside: FUNCNAME = $FUNCNAME func diff --git a/tests/func.tests~ b/tests/func.tests~ index 063f4e0b8..cbbbdb035 100644 --- a/tests/func.tests~ +++ b/tests/func.tests~ @@ -165,4 +165,12 @@ myfunction() { myfunction myfunction | cat +segv() +{ + echo foo | return 5 +} + +segv +echo $? + exit 0 diff --git a/variables.c b/variables.c index c23732650..5fd9d0e99 100644 --- a/variables.c +++ b/variables.c @@ -2976,7 +2976,10 @@ void dispose_used_env_vars () { if (temporary_env) - dispose_temporary_env (propagate_temp_var); + { + dispose_temporary_env (propagate_temp_var); + maybe_make_export_env (); + } } /* Take all of the shell variables in the temporary environment HASH_TABLE diff --git a/variables.c~ b/variables.c~ index 449975e06..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++]; ) { @@ -346,8 +354,6 @@ initialize_shell_variables (env, privmode) else { temp_var = bind_variable (name, string, 0); -if (strcmp(name,"LANG") == 0) - itrace("bound LANG to %s", string); VSETATTR (temp_var, (att_exported | att_imported)); array_needs_making = 1; } @@ -364,11 +370,7 @@ if (strcmp(name,"LANG") == 0) 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 (); @@ -1308,20 +1310,11 @@ static SHELL_VAR * get_comp_wordbreaks (var) SHELL_VAR *var; { - char *p; - /* If we don't have anything yet, assign a default value. */ if (rl_completer_word_break_characters == 0 && bash_readline_initialized == 0) enable_hostname_completion (perform_hostname_completion); -#if 0 - FREE (value_cell (var)); - p = savestring (rl_completer_word_break_characters); - - var_setvalue (var, p); -#else var_setvalue (var, rl_completer_word_break_characters); -#endif return (var); } @@ -1637,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); @@ -1779,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; @@ -1951,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 @@ -2035,16 +2023,11 @@ bind_int_variable (lhs, rhs) char *lhs, *rhs; { register SHELL_VAR *v; - char *t; int isint, isarr; isint = isarr = 0; #if defined (ARRAY_VARS) -# if 0 - if (t = xstrchr (lhs, '[')) /*]*/ -# else if (valid_array_reference (lhs)) -# endif { isarr = 1; v = array_variable_part (lhs, (char **)0, (int *)0); -- 2.47.3