commit bash-20050113 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 13:42:43 -05:00
parent 227f982e3d
commit 3de8929be1
20 changed files with 1810 additions and 971 deletions
-23
View File
@@ -10901,26 +10901,3 @@ variables.c
generator only gets re-seeded once in a subshell environment, and
assigning a value to RANDOM counts as seeding the generator. This
makes the sequences a little more predictable
1/20
----
lib/readline/history.c
- fix replace_history_entry, remove_history to return NULL if
passed index is < 0
1/22
----
lib/sh/netconn.c
- fix isnetconn() to understand that getpeername can return ENOTCONN
to indicate that an fd is not a socket
configure.in
- set BUILD_DIR to contain backslashes to escape any spaces in the
directory name -- this is what make will accept in targets and
prerequisites, so it's better than trying to use double quotes
- set SIZE to the appropriate value if some cross-compiling tool
chain is being used; `size' by default (can be overridden by
SIZE environment variable)
Makefile.in
- use $(SIZE) instead of size; set SIZE from configure
-26
View File
@@ -10895,29 +10895,3 @@ tests/iquote.tests
dispose_cmd.c
- set w->word to 0 before putting a WORD_DESC * back in the cache in
dispose_word_desc; changed callers to delete those assignments
variables.c
- change assign_random and get_random_value so that the random number
generator only gets re-seeded once in a subshell environment, and
assigning a value to RANDOM counts as seeding the generator. This
makes the sequences a little more predictable
1/20
----
lib/readline/history.c
- fix replace_history_entry, remove_history to return NULL if
passed index is < 0
1/22
----
lib/sh/netconn.c
- fix isnetconn() to understand that getpeername can return ENOTCONN
to indicate that an fd is not a socket
configure.in
- set BUILD_DIR to contain backslashes to escape any spaces in the
directory name -- this is what make will accept in targets and
prerequisites, so it's better than trying to use double quotes
Makefile.in
- use $(SIZE) instead of size; set SIZE from configure
+4
View File
@@ -771,6 +771,8 @@ tests/input-line.sub f
tests/input.right f
tests/intl.tests f
tests/intl.right f
tests/iquote.tests f
tests/iquote.right f
tests/invert.tests f
tests/invert.right f
tests/jobs.tests f
@@ -826,6 +828,7 @@ tests/redir4.sub f
tests/redir4.in1 f
tests/redir5.sub f
tests/redir6.sub f
tests/redir7.sub f
tests/rhs-exp.tests f
tests/rhs-exp.right f
tests/rsh.tests f
@@ -862,6 +865,7 @@ tests/run-history f
tests/run-ifs f
tests/run-input-test f
tests/run-intl f
tests/run-iquote f
tests/run-invert f
tests/run-jobs f
tests/run-more-exp f
+4 -5
View File
@@ -1,6 +1,6 @@
# Makefile for bash-3.0, version 2.155
# Makefile for bash-3.0, version 2.154
#
# Copyright (C) 1996-2005 Free Software Foundation, Inc.
# Copyright (C) 1996-2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -67,7 +67,6 @@ RM = rm -f
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
SIZE = @SIZE@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -515,7 +514,7 @@ $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
$(RM) $@
$(PURIFY) $(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
ls -l $(Program)
-$(SIZE) $(Program)
-size $(Program)
.build: $(SOURCES) config.h Makefile version.h $(VERSPROG)
@echo
@@ -537,7 +536,7 @@ bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile $(VERSPROG)
strip: $(Program) .made
strip $(Program)
ls -l $(Program)
-$(SIZE) $(Program)
-size $(Program)
lint:
${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made
+2 -28
View File
@@ -1,5 +1,5 @@
@%:@! /bin/sh
@%:@ From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION.
@%:@ From configure.in for Bash 3.0, version 3.172, from autoconf version AC_ACVERSION.
@%:@ Guess values for system-dependent variables and create Makefiles.
@%:@ Generated by GNU Autoconf 2.57 for bash 3.1-devel.
@%:@
@@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL SIZE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIB@&t@OBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIB@&t@OBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4927,27 +4927,6 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
if test x$SIZE = x; then
if test x$ac_tool_prefix = x; then
SIZE=size
else
SIZE=${ac_tool_prefix}size
save_IFS=$IFS ; IFS=:
size_found=0
for dir in $PATH; do
if test -x $dir/$SIZE ; then
size_found=1
break
fi
done
if test $size_found -eq 0; then
SIZE=size
fi
IFS=$save_IFS
fi
fi
cat >>confdefs.h <<\_ACEOF
@%:@define _GNU_SOURCE 1
_ACEOF
@@ -24167,10 +24146,6 @@ case "$srcdir" in
esac
BUILD_DIR=`pwd`
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
@@ -24902,7 +24877,6 @@ s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@YACC@,$YACC,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@MAKE_SHELL@,$MAKE_SHELL,;t t
s,@SIZE@,$SIZE,;t t
s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
s,@USE_NLS@,$USE_NLS,;t t
s,@MSGFMT@,$MSGFMT,;t t
+83 -83
View File
@@ -15,96 +15,96 @@
'configure.in'
],
{
'AC_PROG_RANLIB' => 1,
'AC_CHECK_LIB' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_C_VOLATILE' => 1,
'AC_HEADER_STDC' => 1,
'm4_pattern_forbid' => 1,
'AC_INIT' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_CONFIG_FILES' => 1,
'include' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_PROG_AWK' => 1,
'AM_CONDITIONAL' => 1,
'AC_PROG_CC' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_HEADER_TIME' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_TYPE_SIGNAL' => 1,
'm4_include' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_CHECK_TYPES' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_STRUCT_TM' => 1,
'AC_PROG_YACC' => 1,
'm4_pattern_allow' => 1,
'AC_PROG_CXX' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_PATH_X' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_FUNC_FORK' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_FUNC_ALLOCA' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_PROG_LEX' => 1,
'AC_INIT' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_LIBSOURCE' => 1,
'AC_C_INLINE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AH_OUTPUT' => 1,
'AC_PROG_CPP' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_HEADER_STAT' => 1,
'AC_C_VOLATILE' => 1,
'AC_FUNC_STRFTIME' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_HEADER_STDC' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_PROG_LN_S' => 1,
'AC_TYPE_UID_T' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_CHECK_FUNCS' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_FUNC_STAT' => 1,
'include' => 1,
'AC_FUNC_MMAP' => 1,
'AC_FUNC_MKTIME' => 1,
'AM_CONDITIONAL' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_C_CONST' => 1,
'AC_CONFIG_FILES' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_SUBST' => 1,
'AC_PROG_INSTALL' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_TYPE_PID_T' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_FUNC_WAIT3' => 1,
'm4_pattern_forbid' => 1,
'AC_PROG_AWK' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_C_INLINE' => 1,
'AC_FUNC_STAT' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_CHECK_HEADERS' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_MMAP' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_FUNC_MEMCMP' => 1
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_LIBSOURCE' => 1,
'AC_SUBST' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_PROG_YACC' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_TYPE_UID_T' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_CHECK_FUNCS' => 1,
'AC_PROG_LN_S' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_PROG_CPP' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_PROG_CXX' => 1,
'AC_HEADER_TIME' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_PROG_LEX' => 1,
'm4_pattern_allow' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_FUNC_FORK' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_PATH_X' => 1,
'AC_PROG_RANLIB' => 1,
'AC_HEADER_STAT' => 1,
'AC_CHECK_TYPES' => 1,
'AC_STRUCT_TM' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_C_CONST' => 1,
'AC_FUNC_ALLOCA' => 1,
'AH_OUTPUT' => 1,
'AC_PROG_INSTALL' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_TYPE_SIGNAL' => 1,
'm4_include' => 1
}
], 'Request' )
);
+619 -620
View File
File diff suppressed because it is too large Load Diff
Vendored
+2 -28
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION.
# From configure.in for Bash 3.0, version 3.172, from autoconf version AC_ACVERSION.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for bash 3.1-devel.
#
@@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL SIZE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os EMACS lispdir DEBUGGER_START_FILE TESTSCRIPT PURIFY MALLOC_TARGET MALLOC_SRC MALLOC_LIB MALLOC_LIBRARY MALLOC_LDFLAGS MALLOC_DEP htmldir HELPDIR HELPDIRDEFINE HELPINSTALL HELPSTRINGS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SIGNAMES_H CC_FOR_BUILD STATIC_LD CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD RL_VERSION RL_MAJOR RL_MINOR READLINE_LIB READLINE_DEP RL_LIBDIR RL_INCLUDEDIR RL_INCLUDE HISTORY_LIB HISTORY_DEP HIST_LIBDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB YACC SET_MAKE MAKE_SHELL MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS INTL_DEP INTL_INC LIBINTL_H SIGLIST_O TERMCAP_LIB TERMCAP_DEP JOBS_O SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS PROFILE_FLAGS incdir BUILD_DIR ARFLAGS BASHVERS RELSTATUS DEBUG MALLOC_DEBUG LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4927,27 +4927,6 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
if test x$SIZE = x; then
if test x$ac_tool_prefix = x; then
SIZE=size
else
SIZE=${ac_tool_prefix}size
save_IFS=$IFS ; IFS=:
size_found=0
for dir in $PATH; do
if test -x $dir/$SIZE ; then
size_found=1
break
fi
done
if test $size_found -eq 0; then
SIZE=size
fi
IFS=$save_IFS
fi
fi
cat >>confdefs.h <<\_ACEOF
#define _GNU_SOURCE 1
_ACEOF
@@ -24167,10 +24146,6 @@ case "$srcdir" in
esac
BUILD_DIR=`pwd`
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
@@ -24902,7 +24877,6 @@ s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@YACC@,$YACC,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@MAKE_SHELL@,$MAKE_SHELL,;t t
s,@SIZE@,$SIZE,;t t
s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
s,@USE_NLS@,$USE_NLS,;t t
s,@MSGFMT@,$MSGFMT,;t t
+3 -29
View File
@@ -1,11 +1,11 @@
dnl
dnl Configure script for bash-3.1
dnl Configure script for bash-3.0
dnl
dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2005 Free Software Foundation, Inc.
# Copyright (C) 1987-2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ 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.1, version 3.173, from autoconf version] AC_ACVERSION)dnl
AC_REVISION([for Bash 3.0, version 3.172, from autoconf version] AC_ACVERSION)dnl
define(bashvers, 3.1)
define(relstatus, devel)
@@ -557,28 +557,6 @@ opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
esac
AC_SUBST(MAKE_SHELL)
dnl this is similar to the expanded AC_PROG_RANLIB
if test x$SIZE = x; then
if test x$ac_tool_prefix = x; then
SIZE=size
else
SIZE=${ac_tool_prefix}size
save_IFS=$IFS ; IFS=:
size_found=0
for dir in $PATH; do
if test -x $dir/$SIZE ; then
size_found=1
break
fi
done
if test $size_found -eq 0; then
SIZE=size
fi
IFS=$save_IFS
fi
fi
AC_SUBST(SIZE)
dnl Turn on any extensions available in the GNU C library.
AC_DEFINE(_GNU_SOURCE, 1)
@@ -1026,10 +1004,6 @@ case "$srcdir" in
esac
BUILD_DIR=`pwd`
case "$BUILD_DIR" in
*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
*) ;;
esac
AC_SUBST(PROFILE_FLAGS)
+328
View File
@@ -0,0 +1,328 @@
/* dispose_command.c -- dispose of a COMMAND structure. */
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include "config.h"
#include "bashtypes.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "bashansi.h"
#include "shell.h"
extern sh_obj_cache_t wdcache, wlcache;
/* Dispose of the command structure passed. */
void
dispose_command (command)
COMMAND *command;
{
if (command == 0)
return;
if (command->redirects)
dispose_redirects (command->redirects);
switch (command->type)
{
case cm_for:
#if defined (SELECT_COMMAND)
case cm_select:
#endif
{
register FOR_COM *c;
#if defined (SELECT_COMMAND)
if (command->type == cm_select)
c = (FOR_COM *)command->value.Select;
else
#endif
c = command->value.For;
dispose_word (c->name);
dispose_words (c->map_list);
dispose_command (c->action);
free (c);
break;
}
#if defined (ARITH_FOR_COMMAND)
case cm_arith_for:
{
register ARITH_FOR_COM *c;
c = command->value.ArithFor;
dispose_words (c->init);
dispose_words (c->test);
dispose_words (c->step);
dispose_command (c->action);
free (c);
break;
}
#endif /* ARITH_FOR_COMMAND */
case cm_group:
{
dispose_command (command->value.Group->command);
free (command->value.Group);
break;
}
case cm_subshell:
{
dispose_command (command->value.Subshell->command);
free (command->value.Subshell);
break;
}
case cm_case:
{
register CASE_COM *c;
PATTERN_LIST *t, *p;
c = command->value.Case;
dispose_word (c->word);
for (p = c->clauses; p; )
{
dispose_words (p->patterns);
dispose_command (p->action);
t = p;
p = p->next;
free (t);
}
free (c);
break;
}
case cm_until:
case cm_while:
{
register WHILE_COM *c;
c = command->value.While;
dispose_command (c->test);
dispose_command (c->action);
free (c);
break;
}
case cm_if:
{
register IF_COM *c;
c = command->value.If;
dispose_command (c->test);
dispose_command (c->true_case);
dispose_command (c->false_case);
free (c);
break;
}
case cm_simple:
{
register SIMPLE_COM *c;
c = command->value.Simple;
dispose_words (c->words);
dispose_redirects (c->redirects);
free (c);
break;
}
case cm_connection:
{
register CONNECTION *c;
c = command->value.Connection;
dispose_command (c->first);
dispose_command (c->second);
free (c);
break;
}
#if defined (DPAREN_ARITHMETIC)
case cm_arith:
{
register ARITH_COM *c;
c = command->value.Arith;
dispose_words (c->exp);
free (c);
break;
}
#endif /* DPAREN_ARITHMETIC */
#if defined (COND_COMMAND)
case cm_cond:
{
register COND_COM *c;
c = command->value.Cond;
dispose_cond_node (c);
break;
}
#endif /* COND_COMMAND */
case cm_function_def:
{
register FUNCTION_DEF *c;
c = command->value.Function_def;
dispose_function_def (c);
break;
}
default:
command_error ("dispose_command", CMDERR_BADTYPE, command->type, 0);
break;
}
free (command);
}
#if defined (COND_COMMAND)
/* How to free a node in a conditional command. */
void
dispose_cond_node (cond)
COND_COM *cond;
{
if (cond)
{
if (cond->left)
dispose_cond_node (cond->left);
if (cond->right)
dispose_cond_node (cond->right);
if (cond->op)
dispose_word (cond->op);
free (cond);
}
}
#endif /* COND_COMMAND */
void
dispose_function_def_contents (c)
FUNCTION_DEF *c;
{
dispose_word (c->name);
dispose_command (c->command);
FREE (c->source_file);
}
void
dispose_function_def (c)
FUNCTION_DEF *c;
{
dispose_function_def_contents (c);
free (c);
}
/* How to free a WORD_DESC. */
void
dispose_word (w)
WORD_DESC *w;
{
FREE (w->word);
ocache_free (wdcache, WORD_DESC, w);
}
/* Free a WORD_DESC, but not the word contained within. */
void
dispose_word_desc (w)
WORD_DESC *w;
{
ocache_free (wdcache, WORD_DESC, w);
}
/* How to get rid of a linked list of words. A WORD_LIST. */
void
dispose_words (list)
WORD_LIST *list;
{
WORD_LIST *t;
while (list)
{
t = list;
list = list->next;
dispose_word (t->word);
#if 0
free (t);
#else
ocache_free (wlcache, WORD_LIST, t);
#endif
}
}
#ifdef INCLUDE_UNUSED
/* How to dispose of an array of pointers to char. This is identical to
free_array in stringlib.c. */
void
dispose_word_array (array)
char **array;
{
register int count;
if (array == 0)
return;
for (count = 0; array[count]; count++)
free (array[count]);
free (array);
}
#endif
/* How to dispose of an list of redirections. A REDIRECT. */
void
dispose_redirects (list)
REDIRECT *list;
{
register REDIRECT *t;
while (list)
{
t = list;
list = list->next;
switch (t->instruction)
{
case r_reading_until:
case r_deblank_reading_until:
free (t->here_doc_eof);
/*FALLTHROUGH*/
case r_reading_string:
case r_output_direction:
case r_input_direction:
case r_inputa_direction:
case r_appending_to:
case r_err_and_out:
case r_input_output:
case r_output_force:
case r_duplicating_input_word:
case r_duplicating_output_word:
case r_move_input_word:
case r_move_output_word:
dispose_word (t->redirectee.filename);
/* FALLTHROUGH */
default:
break;
}
free (t);
}
}
+10 -8
View File
@@ -340,7 +340,7 @@ replace_history_entry (which, line, data)
{
HIST_ENTRY *temp, *old_value;
if (which < 0 || which >= history_length)
if (which >= history_length)
return ((HIST_ENTRY *)NULL);
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
@@ -364,15 +364,17 @@ remove_history (which)
HIST_ENTRY *return_value;
register int i;
if (which < 0 || which >= history_length || history_length == 0)
return ((HIST_ENTRY *)NULL);
if (which >= history_length || !history_length)
return_value = (HIST_ENTRY *)NULL;
else
{
return_value = the_history[which];
return_value = the_history[which];
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
history_length--;
history_length--;
}
return (return_value);
}
+4 -7
View File
@@ -77,20 +77,18 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
char *string;
int seed, count, find_non_zero;
{
size_t tmp;
size_t tmp = 0;
mbstate_t ps;
int point;
int point = 0;
wchar_t wc;
tmp = 0;
memset(&ps, 0, sizeof (mbstate_t));
if (seed < 0)
seed = 0;
if (count <= 0)
return seed;
point = seed + _rl_adjust_point (string, seed, &ps);
point = seed + _rl_adjust_point(string, seed, &ps);
/* if this is true, means that seed was not pointed character
started byte. So correct the point and consume count */
if (seed < point)
@@ -136,8 +134,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
break;
}
}
return point;
return point;
}
static int
+2 -2
View File
@@ -52,8 +52,8 @@ isnetconn (fd)
l = sizeof(sa);
rv = getpeername(fd, &sa, &l);
/* Posix.2 says getpeername can return these errors. */
return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL)) ? 0 : 1);
/* Solaris 2.5 getpeername() returns EINVAL if the fd is not a socket. */
return ((rv < 0 && (errno == ENOTSOCK || errno == EINVAL)) ? 0 : 1);
#else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
# if defined (SVR4) || defined (SVR4_2)
/* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */
+258 -105
View File
@@ -163,6 +163,7 @@ static int glob_argv_flags_size;
#endif
static WORD_LIST expand_word_error, expand_word_fatal;
static WORD_DESC expand_wdesc_error, expand_wdesc_fatal;
static char expand_param_error, expand_param_fatal;
/* Tell the expansion functions to not longjmp back to top_level on fatal
@@ -259,9 +260,9 @@ static arrayind_t array_length_reference __P((char *));
static int valid_brace_expansion_word __P((char *, int));
static int chk_atstar __P((char *, int, int *, int *));
static char *parameter_brace_expand_word __P((char *, int, int));
static char *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
static char *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int));
static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
static void parameter_brace_expand_error __P((char *, char *));
static int valid_length_expression __P((char *));
@@ -277,8 +278,8 @@ static char *pos_params_pat_subst __P((char *, char *, char *, int));
static char *parameter_brace_patsub __P((char *, char *, char *, int));
static char *parameter_brace_expand __P((char *, int *, int, int *, int *));
static char *param_expand __P((char *, int *, int, int *, int *, int *, int *, int));
static WORD_DESC *parameter_brace_expand __P((char *, int *, int, int *, int *));
static WORD_DESC *param_expand __P((char *, int *, int, int *, int *, int *, int *, int));
static WORD_LIST *expand_word_internal __P((WORD_DESC *, int, int, int *, int *));
@@ -1799,7 +1800,7 @@ string_list_dollar_at (list, quoted)
WORD_LIST *list;
int quoted;
{
char *ifs;
char *ifs, *ret;
#if defined (HANDLE_MULTIBYTE)
char sep[MB_CUR_MAX + 1];
#else
@@ -1813,19 +1814,15 @@ string_list_dollar_at (list, quoted)
#if defined (HANDLE_MULTIBYTE)
if (ifs && *ifs)
{
size_t mblength;
mblength = MBLEN (ifs, strnlen (ifs, MB_CUR_MAX));
if (MB_INVALIDCH (mblength) || mblength == 1)
if (ifs_firstc_len == 1)
{
sep[0] = *ifs;
sep[0] = ifs_firstc[0];
sep[1] = '\0';
}
else if (mblength == 0)
sep[0] = '\0';
else
{
memcpy (sep, ifs, mblength);
sep[mblength] = '\0';
memcpy (sep, ifs_firstc, ifs_firstc_len);
sep[ifs_firstc_len] = '\0';
}
}
else
@@ -1929,10 +1926,9 @@ list_string (string, separators, quoted)
below. */
if (QUOTED_NULL (current_word))
{
t = make_bare_word ("");
t->flags |= W_QUOTED;
free (t->word);
t = alloc_word_desc ();
t->word = make_quoted_char ('\0');
t->flags |= W_QUOTED|W_HASQUOTEDNULL;
result = make_word_list (t, result);
}
else if (current_word[0] != '\0')
@@ -1941,6 +1937,7 @@ list_string (string, separators, quoted)
perform quoted null character removal on the current word. */
remove_quoted_nulls (current_word);
result = add_string_to_list (current_word, result);
result->word->flags &= ~W_HASQUOTEDNULL; /* just to be sure */
if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
result->word->flags |= W_QUOTED;
}
@@ -1949,10 +1946,9 @@ list_string (string, separators, quoted)
Bourne shell style, then add a quoted null argument. */
else if (!sh_style_split && !spctabnl (string[sindex]))
{
t = make_bare_word ("");
t->flags |= W_QUOTED;
free (t->word);
t = alloc_word_desc ();
t->word = make_quoted_char ('\0');
t->flags |= W_QUOTED|W_HASQUOTEDNULL;
result = make_word_list (t, result);
}
@@ -2685,7 +2681,10 @@ expand_string_unsplit (string, quoted)
if (value)
{
if (value->word)
remove_quoted_nulls (value->word->word);
{
remove_quoted_nulls (value->word->word);
value->word->flags &= ~W_HASQUOTEDNULL;
}
dequote_list (value);
}
return (value);
@@ -2715,7 +2714,10 @@ expand_string_assignment (string, quoted)
if (value)
{
if (value->word)
remove_quoted_nulls (value->word->word);
{
remove_quoted_nulls (value->word->word);
value->word->flags &= ~W_HASQUOTEDNULL;
}
dequote_list (value);
}
return (value);
@@ -2753,7 +2755,10 @@ expand_prompt_string (string, quoted)
if (value)
{
if (value->word)
remove_quoted_nulls (value->word->word);
{
remove_quoted_nulls (value->word->word);
value->word->flags &= ~W_HASQUOTEDNULL;
}
dequote_list (value);
}
return (value);
@@ -3132,7 +3137,10 @@ word_list_remove_quoted_nulls (list)
register WORD_LIST *t;
for (t = list; t; t = t->next)
remove_quoted_nulls (t->word->word);
{
remove_quoted_nulls (t->word->word);
t->word->flags &= ~W_HASQUOTEDNULL;
}
}
/* **************************************************************** */
@@ -3738,8 +3746,13 @@ list_remove_pattern (list, pattern, patspec, itype, quoted)
for (new = (WORD_LIST *)NULL, l = list; l; l = l->next)
{
tword = remove_pattern (l->word->word, pattern, patspec);
#if 0
w = make_bare_word (tword);
FREE (tword);
#else
w = alloc_word_desc ();
w->word = tword ? tword : savestring ("");
#endif
new = make_word_list (w, new);
}
@@ -4720,18 +4733,21 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at)
VAR_IS_SPECIAL is non-zero if NAME is one of the special variables in
the shell, e.g., "@", "$", "*", etc. QUOTED, if non-zero, means that
NAME was found inside of a double-quoted expression. */
static char *
static WORD_DESC *
parameter_brace_expand_word (name, var_is_special, quoted)
char *name;
int var_is_special, quoted;
{
WORD_DESC *ret;
char *temp, *tt;
intmax_t arg_index;
SHELL_VAR *var;
int atype;
/* Handle multiple digit arguments, as in ${11}. */
ret = 0;
temp = 0;
/* Handle multiple digit arguments, as in ${11}. */
if (legal_number (name, &arg_index))
{
tt = get_dollar_var_value (arg_index);
@@ -4750,8 +4766,8 @@ parameter_brace_expand_word (name, var_is_special, quoted)
tt[sindex = 0] = '$';
strcpy (tt + 1, name);
temp = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
(int *)NULL, (int *)NULL, 0);
ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
(int *)NULL, (int *)NULL, 0);
free (tt);
}
#if defined (ARRAY_VARS)
@@ -4785,20 +4801,28 @@ parameter_brace_expand_word (name, var_is_special, quoted)
else
temp = (char *)NULL;
return (temp);
if (ret == 0)
{
ret = alloc_word_desc ();
ret->word = temp;
}
return ret;
}
/* Expand an indirect reference to a variable: ${!NAME} expands to the
value of the variable whose name is the value of NAME. */
static char *
static WORD_DESC *
parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at)
char *name;
int var_is_special, quoted;
int *quoted_dollar_atp, *contains_dollar_at;
{
char *temp, *t;
WORD_DESC *w;
t = parameter_brace_expand_word (name, var_is_special, quoted);
w = parameter_brace_expand_word (name, var_is_special, quoted);
t = w->word;
w->word = 0;
/* Have to dequote here if necessary */
if (t)
{
@@ -4808,23 +4832,28 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
free (t);
t = temp;
}
dispose_word_desc (w);
chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at);
if (t == 0)
return (t);
temp = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted);
return (WORD_DESC *)NULL;
w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted);
free (t);
return temp;
return w;
}
/* Expand the right side of a parameter expansion of the form ${NAMEcVALUE},
depending on the value of C, the separating character. C can be one of
"-", "+", or "=". QUOTED is true if the entire brace expression occurs
between double quotes. */
static char *
static WORD_DESC *
parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
char *name, *value;
int c, quoted, *qdollaratp, *hasdollarat;
{
WORD_DESC *w;
WORD_LIST *l;
char *t, *t1, *temp;
int hasdol;
@@ -4840,6 +4869,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
else
temp = value;
w = alloc_word_desc ();
hasdol = 0;
/* XXX was 0 not quoted */
l = *temp ? expand_string_for_rhs (temp, quoted, &hasdol, (int *)NULL)
@@ -4873,12 +4903,16 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
temp = (char *)xmalloc (2);
temp[0] = CTLNUL;
temp[1] = '\0';
w->flags |= W_HASQUOTEDNULL;
}
else
temp = (char *)NULL;
if (c == '-' || c == '+')
return (temp);
{
w->word = temp;
return w;
}
/* c == '=' */
t = temp ? savestring (temp) : savestring ("");
@@ -4891,7 +4925,9 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
#endif /* ARRAY_VARS */
bind_variable (name, t1, 0);
free (t1);
return (temp);
w->word = temp;
return w;
}
/* Deal with the right hand side of a ${name:?value} expansion in the case
@@ -5266,7 +5302,6 @@ get_var_and_type (varname, value, quoted, varp, valp)
}
else
#endif
#if 1
{
if (value && vtype == VT_VARIABLE)
{
@@ -5278,9 +5313,6 @@ get_var_and_type (varname, value, quoted, varp, valp)
else
*valp = value;
}
#else
*valp = (value && vtype == VT_VARIABLE) ? dequote_escapes (value) : value;
#endif
return vtype;
}
@@ -5506,10 +5538,15 @@ pos_params_pat_subst (string, pat, rep, mflags)
for ( ; params; params = params->next)
{
ret = pat_subst (params->word->word, pat, rep, mflags);
#if 0
w = make_bare_word (ret);
FREE (ret);
#else
w = alloc_word_desc ();
w->word = ret ? ret : savestring ("");
#endif
dispose_word (params->word);
params->word = w;
FREE (ret);
}
if ((mflags & (MATCH_QUOTED|MATCH_STARSUB)) == (MATCH_QUOTED|MATCH_STARSUB))
@@ -5658,7 +5695,7 @@ parameter_brace_patsub (varname, value, patsub, quoted)
/****************************************************************/
/* ${[#][!]name[[:]#[#]%[%]-=?+[word][:e1[:e2]]]} */
static char *
static WORD_DESC *
parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_dollar_at)
char *string;
int *indexp, quoted, *quoted_dollar_atp, *contains_dollar_at;
@@ -5666,7 +5703,8 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
int check_nullness, var_is_set, var_is_null, var_is_special;
int want_substring, want_indir, want_patsub;
char *name, *value, *temp, *temp1;
int t_index, sindex, c;
WORD_DESC *tdesc, *ret;
int t_index, sindex, c, tflag;
intmax_t number;
value = (char *)NULL;
@@ -5677,6 +5715,9 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
t_index = ++sindex;
name = string_extract (string, &t_index, "#%:-=?+/}", EX_VARNAME);
ret = 0;
tflag = 0;
/* If the name really consists of a special variable, then make sure
that we have the entire name. We don't allow indirect references
to special variables except `#', `?', `@' and `*'. */
@@ -5779,7 +5820,14 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
free (name);
*indexp = sindex;
return ((number < 0) ? &expand_param_error : itos (number));
if (number < 0)
return (&expand_wdesc_error);
else
{
ret = alloc_word_desc ();
ret->word = itos (number);
return ret;
}
}
/* ${@} is identical to $@. */
@@ -5819,7 +5867,10 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
free (xlist);
free (temp1);
*indexp = sindex;
return (temp);
ret = alloc_word_desc ();
ret->word = temp;
return ret;
}
#if defined (ARRAY_VARS)
@@ -5845,7 +5896,10 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
free (temp1);
*indexp = sindex;
return (temp);
ret = alloc_word_desc ();
ret->word = temp;
return ret;
}
free (temp1);
@@ -5861,9 +5915,19 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
}
if (want_indir)
temp = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
else
temp = parameter_brace_expand_word (name, var_is_special, quoted);
tdesc = parameter_brace_expand_word (name, var_is_special, quoted);
if (tdesc)
{
temp = tdesc->word;
tflag = tdesc->flags;
tdesc->word = 0;
dispose_word_desc (tdesc);
}
else
temp = (char *)0;
#if defined (ARRAY_VARS)
if (valid_array_reference (name))
@@ -5896,7 +5960,15 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (name);
FREE (value);
FREE (temp);
return (temp1);
if (temp1 == &expand_param_error)
return (&expand_wdesc_error);
else if (temp1 == &expand_param_fatal)
return (&expand_wdesc_fatal);
ret = alloc_word_desc ();
ret->word = temp1;
return ret;
}
else if (want_patsub)
{
@@ -5904,7 +5976,15 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (name);
FREE (value);
FREE (temp);
return (temp1);
if (temp1 == &expand_param_error)
return (&expand_wdesc_error);
else if (temp1 == &expand_param_fatal)
return (&expand_wdesc_fatal);
ret = alloc_word_desc ();
ret->word = temp1;
return ret;
}
/* Do the right thing based on which character ended the variable name. */
@@ -5917,7 +5997,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (value);
FREE (temp);
free (name);
return &expand_param_error;
return &expand_wdesc_error;
case RBRACE:
if (var_is_set == 0 && unbound_vars_is_error)
@@ -5927,7 +6007,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (temp);
free (name);
last_command_exit_value = EXECUTION_FAILURE;
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
break;
@@ -5966,10 +6046,12 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
FREE (temp);
if (value)
{
temp = parameter_brace_expand_rhs (name, value, c,
quoted,
quoted_dollar_atp,
contains_dollar_at);
ret = parameter_brace_expand_rhs (name, value, c,
quoted,
quoted_dollar_atp,
contains_dollar_at);
/* XXX - fix up later, esp. noting presence of
W_HASQUOTEDNULL in ret->flags */
free (value);
}
else
@@ -5990,12 +6072,12 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
report_error (_("$%s: cannot assign in this way"), name);
free (name);
free (value);
return &expand_param_error;
return &expand_wdesc_error;
}
else if (c == '?')
{
parameter_brace_expand_error (name, value);
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
else if (c != '+')
{
@@ -6007,9 +6089,11 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
if (contains_dollar_at)
*contains_dollar_at = 0;
temp = parameter_brace_expand_rhs (name, value, c, quoted,
quoted_dollar_atp,
contains_dollar_at);
ret = parameter_brace_expand_rhs (name, value, c, quoted,
quoted_dollar_atp,
contains_dollar_at);
/* XXX - fix up later, esp. noting presence of
W_HASQUOTEDNULL in tdesc->flags */
}
free (value);
}
@@ -6017,13 +6101,20 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll
break;
}
free (name);
return (temp);
if (ret == 0)
{
ret = alloc_word_desc ();
ret->flags = tflag;
ret->word = temp;
}
return (ret);
}
/* Expand a single ${xxx} expansion. The braces are optional. When
the braces are used, parameter_brace_expand() does the work,
possibly calling param_expand recursively. */
static char *
static WORD_DESC *
param_expand (string, sindex, quoted, expanded_something,
contains_dollar_at, quoted_dollar_at_p, had_quoted_null_p,
pflags)
@@ -6037,11 +6128,15 @@ param_expand (string, sindex, quoted, expanded_something,
intmax_t number;
SHELL_VAR *var;
WORD_LIST *list;
WORD_DESC *tdesc, *ret;
int tflag;
zindex = *sindex;
c = string[++zindex];
temp = (char *)NULL;
ret = tdesc = (WORD_DESC *)NULL;
tflag = 0;
/* Do simple cases first. Switch on what follows '$'. */
switch (c)
@@ -6065,18 +6160,15 @@ param_expand (string, sindex, quoted, expanded_something,
uerror[2] = '\0';
err_unboundvar (uerror);
last_command_exit_value = EXECUTION_FAILURE;
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
#if 1
if (temp1)
temp = (*temp1 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)))
? quote_string (temp1)
: quote_escapes (temp1);
else
temp = (char *)NULL;
#else
temp = temp1 ? quote_escapes (temp1) : (char *)NULL;
#endif
break;
/* $$ -- pid of the invoking shell. */
@@ -6116,7 +6208,7 @@ param_expand (string, sindex, quoted, expanded_something,
uerror[2] = '\0';
err_unboundvar (uerror);
last_command_exit_value = EXECUTION_FAILURE;
return (interactive_shell ? &expand_param_error : &expand_param_fatal);
return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
}
}
else
@@ -6141,13 +6233,30 @@ param_expand (string, sindex, quoted, expanded_something,
null, the parameters are concatenated. */
temp = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (list) : string_list (list);
temp1 = quote_string (temp);
if (*temp == 0)
tflag |= W_HASQUOTEDNULL;
free (temp);
temp = temp1;
}
else
{
/* If the $* is not quoted it is identical to $@ */
/* We check whether or not we're eventually going to split $* here,
for example when IFS is empty and we are processing the rhs of
an assignment statement. In that case, we don't separate the
arguments at all. Otherwise, if the $* is not quoted it is
identical to $@ */
#if 1
# if defined (HANDLE_MULTIBYTE)
if (expand_no_split_dollar_star && ifs_firstc[0] == 0)
# else
if (expand_no_split_dollar_star && ifs_firstc == 0)
# endif
temp = string_list_dollar_star (list);
else
temp = string_list_dollar_at (list, quoted);
#else
temp = string_list_dollar_at (list, quoted);
#endif
if (expand_no_split_dollar_star == 0 && contains_dollar_at)
*contains_dollar_at = 1;
}
@@ -6183,11 +6292,14 @@ param_expand (string, sindex, quoted, expanded_something,
break;
case LBRACE:
temp = parameter_brace_expand (string, &zindex, quoted,
quoted_dollar_at_p,
contains_dollar_at);
if (temp == &expand_param_error || temp == &expand_param_fatal)
return (temp);
tdesc = parameter_brace_expand (string, &zindex, quoted,
quoted_dollar_at_p,
contains_dollar_at);
/* Fix this later when parameter_brace_expand returns a WORD_DESC * */
if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal)
return (tdesc);
temp = tdesc ? tdesc->word : (char *)0;
/* XXX */
/* Quoted nulls should be removed if there is anything else
@@ -6197,18 +6309,24 @@ param_expand (string, sindex, quoted, expanded_something,
in the string, discard TEMP, and go on. The exception to
this is when we have "${@}" and $1 is '', since $@ needs
special handling. */
/* XXX - fix this once parameter_brace_expand returns a WORD_DESC * */
#if 0
if (temp && QUOTED_NULL (temp))
#else
if (tdesc && tdesc->word && (tdesc->flags & W_HASQUOTEDNULL) && QUOTED_NULL (temp))
#endif
{
if (had_quoted_null_p)
*had_quoted_null_p = 1;
if (*quoted_dollar_at_p == 0)
{
free (temp);
temp = (char *)NULL;
tdesc->word = temp = (char *)NULL;
}
}
ret = tdesc;
goto return0;
/* Do command or arithmetic substitution. */
@@ -6251,10 +6369,10 @@ arithsub:
if (interactive_shell == 0 && posixly_correct)
{
last_command_exit_value = EXECUTION_FAILURE;
return (&expand_param_fatal);
return (&expand_wdesc_fatal);
}
else
return (&expand_param_error);
return (&expand_wdesc_error);
}
temp = itos (number);
break;
@@ -6348,8 +6466,8 @@ unbound_variable:
free (temp1);
last_command_exit_value = EXECUTION_FAILURE;
return ((unbound_vars_is_error && interactive_shell == 0)
? &expand_param_fatal
: &expand_param_error);
? &expand_wdesc_fatal
: &expand_wdesc_error);
}
if (string[zindex])
@@ -6357,7 +6475,14 @@ unbound_variable:
return0:
*sindex = zindex;
return (temp);
if (ret == 0)
{
ret = alloc_word_desc ();
ret->flags = tflag; /* XXX */
ret->word = temp;
}
return ret;
}
/* Make a word list which is the result of parameter and variable
@@ -6597,7 +6722,7 @@ add_string:
goto add_string;
}
else
b {
{
FREE (temp);
goto add_character;
}
@@ -6607,20 +6732,28 @@ b {
*expanded_something = 1;
has_dollar_at = 0;
temp = param_expand (string, &sindex, quoted, expanded_something,
tword = param_expand (string, &sindex, quoted, expanded_something,
&has_dollar_at, &quoted_dollar_at,
&had_quoted_null,
(word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0);
if (temp == &expand_param_error || temp == &expand_param_fatal)
if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
{
free (string);
free (istring);
return ((temp == &expand_param_error) ? &expand_word_error
: &expand_word_fatal);
return ((tword == &expand_wdesc_error) ? &expand_word_error
: &expand_word_fatal);
}
if (contains_dollar_at && has_dollar_at)
*contains_dollar_at = 1;
if (tword && (tword->flags & W_HASQUOTEDNULL))
had_quoted_null = 1;
temp = tword->word;
tword->word = 0;
dispose_word_desc (tword);
goto add_string;
break;
@@ -6702,11 +6835,13 @@ add_twochars:
if (temp && *temp)
{
tword = make_word (temp); /* XXX */
free (temp);
tword = alloc_word_desc ();
tword->word = temp;
temp = (char *)NULL;
has_dollar_at = 0;
/* Need to get W_HASQUOTEDNULL flag through this function. */
list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
if (list == &expand_word_error || list == &expand_word_fatal)
@@ -6742,6 +6877,9 @@ add_twochars:
if (list)
dequote_list (list);
if (list && list->word && (list->word->flags & W_HASQUOTEDNULL))
had_quoted_null = 1;
if (has_dollar_at)
{
quoted_dollar_at++;
@@ -6781,8 +6919,9 @@ add_twochars:
else
{
temp = savestring (list->word->word);
tflag = list->word->flags;
dispose_words (list);
#if 1
/* If the string is not a quoted null string, we want
to remove any embedded unquoted CTLNUL characters.
We do not want to turn quoted null strings back into
@@ -6791,15 +6930,13 @@ add_twochars:
contain other characters. For example, if we have
x"$*"y or "x$*y" and there are no positional parameters,
the $* should expand into nothing. */
/* HOWEVER, this fails if the string contains a literal
CTLNUL or CTLNUL is contained in the (non-null) expansion
of some variable. I'm not sure what to do about this
yet. There has to be some way to indicate the difference
between the two. An auxiliary data structure might be
necessary. */
if (QUOTED_NULL (temp) == 0)
/* We use the W_HASQUOTEDNULL flag to differentiate the
cases: a quoted null character as above and when
CTLNUL is contained in the (non-null) expansion
of some variable. We use the had_quoted_null flag to
pass the value through this function to its return value. */
if ((tflag & W_HASQUOTEDNULL) && QUOTED_NULL (temp) == 0)
remove_quoted_nulls (temp); /* XXX */
#endif
}
}
else
@@ -6946,6 +7083,7 @@ finished_with_string:
istring[0] = CTLNUL;
istring[1] = '\0';
tword = make_bare_word (istring);
tword->flags |= W_HASQUOTEDNULL; /* XXX */
list = make_word_list (tword, (WORD_LIST *)NULL);
if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
tword->flags |= W_QUOTED;
@@ -6959,9 +7097,9 @@ finished_with_string:
else
{
tword = make_bare_word (istring);
list = make_word_list (tword, (WORD_LIST *)NULL);
if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
tword->flags |= W_QUOTED;
list = make_word_list (tword, (WORD_LIST *)NULL);
}
#else
else
@@ -6971,7 +7109,6 @@ finished_with_string:
else if (word->flags & W_NOSPLIT)
{
tword = make_bare_word (istring);
list = make_word_list (tword, (WORD_LIST *)NULL);
if (word->flags & W_ASSIGNMENT)
tword->flags |= W_ASSIGNMENT; /* XXX */
if (word->flags & W_COMPASSIGN)
@@ -6982,6 +7119,9 @@ finished_with_string:
tword->flags |= W_NOEXPAND; /* XXX */
if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
tword->flags |= W_QUOTED;
if (had_quoted_null)
tword->flags |= W_HASQUOTEDNULL;
list = make_word_list (tword, (WORD_LIST *)NULL);
}
else
{
@@ -7000,7 +7140,6 @@ finished_with_string:
else
{
tword = make_bare_word (istring);
list = make_word_list (tword, (WORD_LIST *)NULL);
if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == WHOLLY_QUOTED))
tword->flags |= W_QUOTED;
if (word->flags & W_ASSIGNMENT)
@@ -7011,6 +7150,9 @@ finished_with_string:
tword->flags |= W_NOGLOB;
if (word->flags & W_NOEXPAND)
tword->flags |= W_NOEXPAND;
if (had_quoted_null)
tword->flags |= W_HASQUOTEDNULL; /* XXX */
list = make_word_list (tword, (WORD_LIST *)NULL);
}
}
@@ -7098,8 +7240,8 @@ word_quote_removal (word, quoted)
char *t;
t = string_quote_removal (word->word, quoted);
w = make_bare_word (t);
free (t);
w = alloc_word_desc ();
w->word = t ? t : savestring ("");
return (w);
}
@@ -7111,12 +7253,23 @@ word_list_quote_removal (list, quoted)
WORD_LIST *list;
int quoted;
{
WORD_LIST *result, *t, *tresult;
WORD_LIST *result, *t, *tresult, *e;
for (t = list, result = (WORD_LIST *)NULL; t; t = t->next)
{
tresult = make_word_list (word_quote_removal (t->word, quoted), (WORD_LIST *)NULL);
#if 0
result = (WORD_LIST *) list_append (result, tresult);
#else
if (result == 0)
result = e = tresult;
else
{
e->next = tresult;
while (e->next)
e = e->next;
}
#endif
}
return (result);
}
+1 -1
View File
@@ -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
+226
View File
@@ -0,0 +1,226 @@
# first, let's start with the basics
recho "$@"
recho "$*"
recho $@
recho $*
set a b
recho "$*"
# If IFS is null, the parameters are joined without separators
IFS=''
recho "$*"
# If IFS is unset, the parameters are separated by spaces
unset IFS
recho "${*}"
recho "$@"
recho $@
IFS='/'
set bob 'tom dick harry' joe
set $*
recho $#
recho $1
recho $2
recho $3
set bob 'tom dick harry' joe
set ${*}
recho $#
recho $1
recho $2
recho $3
set bob 'tom dick harry' joe
set $@
recho $#
recho $1
recho $2
recho $3
set bob 'tom dick harry' joe
set ${@}
recho $#
recho $1
recho $2
recho $3
# according to POSIX.2, unquoted $* should expand to multiple words if
# $IFS is null, just like unquoted $@
IFS=''
set bob 'tom dick harry' joe
set $*
recho $#
recho $1
recho $2
recho $3
set bob 'tom dick harry' joe
set $@
recho $#
recho $1
recho $2
recho $3
# if IFS is unset, the individual positional parameters are split on
# " \t\n" if $* or $@ are unquoted
unset IFS
set bob 'tom dick harry' joe
set $*
recho $#
recho $1
recho $2
recho $3
set bob 'tom dick harry' joe
set $@
recho $#
recho $1
recho $2
recho $3
# but not for "$@" or "$*"
set bob 'tom dick harry' joe
set "$*"
recho $#
recho $1
recho $2
recho $3
set bob 'tom dick harry' joe
set "$@"
recho $#
recho $1
recho $2
recho $3
# POSIX.2 says these should both expand the positional parameters
# to multiple words
set a b c d e
IFS=""
recho $@
recho "$@"
# this example is straight from the POSIX.2 rationale
set foo bar bam
recho "$@"
recho "$*"
unset IFS
recho "$@"
recho $@
recho "$*"
IFS=:
# special variables
set -- 1 2 3 4 5 6 7 8 9 10
bar=${*}
foo=$*
echo foo = "$foo"
echo bar = "$bar"
foo1=$@
bar1=${@}
echo foo1 = "$foo1"
echo bar1 = "$bar1"
foo2="$*"
bar2="${*}"
echo foo2 = "$foo2"
echo bar2 = "$bar2"
eval foo3='$*' bar3='${*}'
echo foo3 = "$foo3"
echo bar3 = "$bar3"
case $* in
*\:*) echo ok 1;;
*) echo bad 1;;
esac
case $@ in
*\:*) echo bad 2;;
*) echo ok 2;;
esac
case "$*" in
*\:*) echo ok 3;;
*) echo bad 3;;
esac
case "$@" in
*\:*) echo bad 4;;
*) echo ok 4;;
esac
IFS=$' \t\n'
bar=${*}
foo=$*
echo foo = "$foo"
echo bar = "$bar"
foo1=$@
bar1=${@}
echo foo1 = "$foo1"
echo bar1 = "$bar1"
foo2="$*"
bar2="${*}"
echo foo2 = "$foo2"
echo bar2 = "$bar2"
eval foo3='$*' bar3='${*}'
echo foo3 = "$foo3"
echo bar3 = "$bar3"
case $* in
*\ *) echo ok 1;;
*) echo bad 1;;
esac
case $@ in
*\ *) echo ok 2;;
*) echo bad 2;;
esac
case "$*" in
*\ *) echo ok 3;;
*) echo bad 3;;
esac
case "$@" in
*\ *) echo ok 4;;
*) echo bad 4;;
esac
# tests for special expansion of "$*" and "${array[*]}" when used with other
# expansions -- bugs through bash-2.05b
${THIS_SH} ./dollar-star1.sub
# tests for expansion of "$@" on rhs of things like ${param:+word}. Bugs
# though bash-2.05b
${THIS_SH} ./dollar-at1.sub
# tests for expansion of other variables in double-quoted strings containing
# $@. Bugs through bash-2.05b
${THIS_SH} ./dollar-at2.sub
# tests for various expansions of $* in different contexts -- word split,
# no splittin, etc. when $IFS is NUL
${THIS_SH} ./dollar-star2.sub
exit 0
+127
View File
@@ -0,0 +1,127 @@
argv[1] = <>
argv[1] = <a b>
argv[1] = <ab>
argv[1] = <a b>
argv[1] = <a>
argv[2] = <b>
argv[1] = <a>
argv[2] = <b>
argv[1] = <3>
argv[1] = <bob>
argv[1] = <tom dick harry>
argv[1] = <joe>
argv[1] = <3>
argv[1] = <bob>
argv[1] = <tom dick harry>
argv[1] = <joe>
argv[1] = <3>
argv[1] = <bob>
argv[1] = <tom dick harry>
argv[1] = <joe>
argv[1] = <3>
argv[1] = <bob>
argv[1] = <tom dick harry>
argv[1] = <joe>
argv[1] = <3>
argv[1] = <bob>
argv[1] = <tom dick harry>
argv[1] = <joe>
argv[1] = <3>
argv[1] = <bob>
argv[1] = <tom dick harry>
argv[1] = <joe>
argv[1] = <5>
argv[1] = <bob>
argv[1] = <tom>
argv[1] = <dick>
argv[1] = <5>
argv[1] = <bob>
argv[1] = <tom>
argv[1] = <dick>
argv[1] = <1>
argv[1] = <bob>
argv[2] = <tom>
argv[3] = <dick>
argv[4] = <harry>
argv[5] = <joe>
argv[1] = <3>
argv[1] = <bob>
argv[1] = <tom>
argv[2] = <dick>
argv[3] = <harry>
argv[1] = <joe>
argv[1] = <a>
argv[2] = <b>
argv[3] = <c>
argv[4] = <d>
argv[5] = <e>
argv[1] = <a>
argv[2] = <b>
argv[3] = <c>
argv[4] = <d>
argv[5] = <e>
argv[1] = <foo>
argv[2] = <bar>
argv[3] = <bam>
argv[1] = <foobarbam>
argv[1] = <foo>
argv[2] = <bar>
argv[3] = <bam>
argv[1] = <foo>
argv[2] = <bar>
argv[3] = <bam>
argv[1] = <foo bar bam>
foo = 1:2:3:4:5:6:7:8:9:10
bar = 1:2:3:4:5:6:7:8:9:10
foo1 = 1 2 3 4 5 6 7 8 9 10
bar1 = 1 2 3 4 5 6 7 8 9 10
foo2 = 1:2:3:4:5:6:7:8:9:10
bar2 = 1:2:3:4:5:6:7:8:9:10
foo3 = 1:2:3:4:5:6:7:8:9:10
bar3 = 1:2:3:4:5:6:7:8:9:10
ok 1
ok 2
ok 3
ok 4
foo = 1 2 3 4 5 6 7 8 9 10
bar = 1 2 3 4 5 6 7 8 9 10
foo1 = 1 2 3 4 5 6 7 8 9 10
bar1 = 1 2 3 4 5 6 7 8 9 10
foo2 = 1 2 3 4 5 6 7 8 9 10
bar2 = 1 2 3 4 5 6 7 8 9 10
foo3 = 1 2 3 4 5 6 7 8 9 10
bar3 = 1 2 3 4 5 6 7 8 9 10
ok 1
ok 2
ok 3
ok 4
xa|xb|xc
xa|xb|xc
a|b|c
a|b|c
a b c
a b c
xa xb xc
xa xb xc
a|b
b|c
a b
b c
a|b|c
a|b|c
xa|xb|xc
xa|xb|xc
3
3
3
3
3
3
3
3
argv[1] = <echo 1 ; echo 1>
argv[1] = <echo 1 2 ; echo 1>
argv[2] = <2>
argv[1] = <echo 1 ; echo 1>
argv[1] = <echo 1 2 ; echo 1>
argv[2] = <2>
+33
View File
@@ -0,0 +1,33 @@
argv[1] = <xxxyyy>
argv[1] = <xxx^?yyy>
argv[1] = <xy>
argv[1] = <x^?y>
argv[1] = <-->
argv[1] = <-^?->
argv[1] = <>
argv[1] = <>
argv[1] = <^?>
argv[1] = <^?yy>
0x7f
0x7f
0x7f
argv[1] = <^?>
argv[1] = <^?@>
argv[1] = <@^?@>
argv[1] = <@^?>
argv[1] = <^?>
argv[1] = <^?@>
argv[1] = <@^?@>
argv[1] = <@^?>
argv[1] = <1>
argv[2] = <^?>
argv[3] = <^?>
argv[1] = <2>
argv[2] = <^?a>
argv[3] = <^?a>
argv[1] = <2>
argv[2] = <^?a>
argv[3] = <^?a>
argv[1] = <3>
argv[2] = <^?aa>
argv[3] = <^?aa>
+86
View File
@@ -0,0 +1,86 @@
# bug in bash up to and including bash-3.0 (including patches)
#
# problem is conflict between CTLNUL used internally to denote quoted null
# characters and its value (0x7f) appearing in the expansion of a variable
#
unset x
recho "xxx${x}yyy"
y=$'\177'
recho "xxx${y}yyy"
unset y
unset undef
set ""
recho ${undef-"x$*y"}
set $'\177'
recho ${undef-"x$*y"}
shift $#
f()
{
recho "-${*-x}-"
}
f ''
f $'\177'
unset -f f
x=12345
recho "${x:6:1}"
x=
recho "${x:0:1}"
y=$'\177'
recho "${y:0:1}"
y=xxx$'\177'yyy
recho "${y:3:3}"
unset x y
eval tmp=`printf "$'\\\\\x%x'\n" 127`
printf "%#1x\n" "'$tmp"
x=$'\177'
printf "%#1x\n" "'$x"
a=127
eval c=\$\'\\$(printf '%o' $a)\'
printf "%#1x\n" "'$c"
recho "$c"
recho "$c"@
recho @"$c"@
recho @"$c"
recho "$c"
recho "$c@"
recho "@$c@"
recho "@$c"
unset tmp x a c
qtest()
{
recho ${#q} "${q}" ${q}
}
q=$'\x7f'
qtest
q=${q}a
qtest
q=$'\x7fa'
qtest
q="${q}a"
qtest
+18 -6
View File
@@ -403,7 +403,10 @@ initialize_shell_variables (env, privmode)
names a mail file if MAILPATH is not set, and we should provide a
default only if neither is set. */
if (interactive_shell)
set_if_not ("MAILCHECK", posixly_correct ? "600" : "60");
{
temp_var = set_if_not ("MAILCHECK", posixly_correct ? "600" : "60");
VSETATTR (temp_var, att_integer);
}
/* Do some things with shell level. */
initialize_shell_level ();
@@ -411,7 +414,8 @@ initialize_shell_variables (env, privmode)
set_ppid ();
/* Initialize the `getopts' stuff. */
bind_variable ("OPTIND", "1", 0);
temp_var = bind_variable ("OPTIND", "1", 0);
VSETATTR (temp_var, att_integer);
getopts_reset (0);
bind_variable ("OPTERR", "1", 0);
sh_opterr = 1;
@@ -1102,6 +1106,7 @@ init_seconds_var ()
/* The random number seed. You can change this by setting RANDOM. */
static unsigned long rseed = 1;
static int last_random_value;
static int seeded_subshell = 0;
/* A linear congruential random number generator based on the example
one in the ANSI C standard. This one isn't very good, but a more
@@ -1131,6 +1136,8 @@ assign_random (self, value, unused)
arrayind_t unused;
{
sbrand (strtoul (value, (char **)NULL, 10));
if (subshell_environment)
seeded_subshell = 1;
return (self);
}
@@ -1140,8 +1147,12 @@ get_random_number ()
int rv;
/* Reset for command and process substitution. */
if (subshell_environment)
sbrand (rseed + getpid() + NOW);
if (subshell_environment && seeded_subshell == 0)
{
itrace("seeding random number gen in subshell");
sbrand (rseed + getpid() + NOW);
seeded_subshell = 1;
}
do
rv = brand ();
@@ -1414,6 +1425,7 @@ initialize_dynamic_variables ()
#if defined (HISTORY)
INIT_DYNAMIC_VAR ("HISTCMD", (char *)NULL, get_histcmd, (sh_var_assign_func_t *)NULL);
VSETATTR (v, att_integer);
#endif
#if defined (READLINE)
@@ -3695,7 +3707,7 @@ struct name_and_function {
};
static struct name_and_function special_vars[] = {
#if defined (READLINE) && defined (PROGRAMMABLE_COMPLETION)
#if defined (READLINE)
{ "COMP_WORDBREAKS", sv_comp_wordbreaks },
#endif
@@ -3850,7 +3862,7 @@ sv_mail (name)
}
}
#if defined (READLINE) && defined (PROGRAMMABLE_COMPLETION)
#if defined (READLINE)
void
sv_comp_wordbreaks (name)
char *name;