From f9732a0465849a00e96ecd85b2a2b220cc48fa5a Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Sat, 3 Dec 2011 12:54:32 -0500 Subject: [PATCH] commit bash-20040205 snapshot --- CHANGES | 5 +- CWRU/CWRU.chlog | 16 ++++- aclocal.m4 | 1 + autom4te.cache/output.0 | 81 +++++++++++++++++++++- autom4te.cache/requests | 148 ++++++++++++++++++++-------------------- autom4te.cache/traces.0 | 1 + config.h.in | 3 + configure | 81 +++++++++++++++++++++- configure.in | 2 +- print_cmd.c | 7 ++ subst.c | 5 ++ tests/RUN-ONE-TEST | 2 +- 12 files changed, 272 insertions(+), 80 deletions(-) diff --git a/CHANGES b/CHANGES index ff9e38df4..51f588cb6 100644 --- a/CHANGES +++ b/CHANGES @@ -57,7 +57,7 @@ q. Fixed a bug that could cause core dumps when checking whether a quoted command name was being completed. r. Fixes to the pattern removal and pattern replacement expansions to deal - with multibyte characters better. + with multibyte characters better (and faster). s. Fix to the substring expansion (${param:off[:len]}) to deal with (possibly multibyte) characters instead of raw bytes. @@ -75,6 +75,9 @@ w. Fixed a bug that caused "$@" to expand incorrectly when used as the right hand side of a parameter expansion such as ${word:="$@"} if the first character of $IFS was not a space. +x. Fixed a slight cosmetic problem when printing commands containing a + `>&word' redirection. + 2. Changes to Readline a. Change to history expansion functions to treat `^' as equivalent to word diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index e18e52e5f..0bc0bd261 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9162,4 +9162,18 @@ subst.c remove_wpattern - new function, wcsdup, wide-character version of strdup(3) - + 2/4 + --- +print_cmd.c + - temporarily translate a >&filename redirection from + r_duplicating_output_word to r_err_and_out (as the expansion code + in redir.c does) so it prints without a leading `1' (file + descriptor) + + 2/5 + --- +aclocal.m4 + - add a check for wcsdup to BASH_CHECK_MULTIBYTE + +config.h.in + - add HAVE_WCSDUP define diff --git a/aclocal.m4 b/aclocal.m4 index 12b3b8026..97f5517dd 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1677,6 +1677,7 @@ AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC)) AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN)) AC_CHECK_FUNC(wctomb, AC_DEFINE(HAVE_WCTOMB)) AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH)) +AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP)) AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t, [AC_TRY_COMPILE([ diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 index 6e93c90fd..fab1f3e56 100644 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -1,5 +1,5 @@ @%:@! /bin/sh -@%:@ From configure.in for Bash 3.0, version 3.161, from autoconf version AC_ACVERSION. +@%:@ From configure.in for Bash 3.0, version 3.162, from autoconf version AC_ACVERSION. @%:@ Guess values for system-dependent variables and create Makefiles. @%:@ Generated by GNU Autoconf 2.57 for bash 3.0-beta1. @%:@ @@ -14614,6 +14614,85 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for wcsdup" >&5 +echo $ECHO_N "checking for wcsdup... $ECHO_C" >&6 +if test "${ac_cv_func_wcsdup+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char wcsdup (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char wcsdup (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_wcsdup) || defined (__stub___wcsdup) +choke me +#else +char (*f) () = wcsdup; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != wcsdup; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_wcsdup=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_wcsdup=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_wcsdup" >&5 +echo "${ECHO_T}$ac_cv_func_wcsdup" >&6 +if test $ac_cv_func_wcsdup = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_WCSDUP 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking for mbstate_t" >&5 echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 diff --git a/autom4te.cache/requests b/autom4te.cache/requests index 355fa7278..506bce332 100644 --- a/autom4te.cache/requests +++ b/autom4te.cache/requests @@ -15,96 +15,96 @@ 'configure.in' ], { - 'AC_TYPE_MODE_T' => 1, - 'AC_C_VOLATILE' => 1, - 'AC_FUNC_STRNLEN' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'AC_PROG_LIBTOOL' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'AC_STRUCT_TM' => 1, 'AC_FUNC_CLOSEDIR_VOID' => 1, - 'AC_TYPE_SIZE_T' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_FUNC_ALLOCA' => 1, + 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, + 'AC_HEADER_SYS_WAIT' => 1, 'AC_PROG_LN_S' => 1, - 'AC_PROG_MAKE_SET' => 1, - 'AC_FUNC_FSEEKO' => 1, - 'AC_LIBSOURCE' => 1, - 'AC_C_INLINE' => 1, - 'AC_DECL_SYS_SIGLIST' => 1, - 'AC_FUNC_OBSTACK' => 1, 'AC_CHECK_FUNCS' => 1, - 'AC_FUNC_UTIME_NULL' => 1, - 'AC_STRUCT_ST_BLOCKS' => 1, - 'AC_FUNC_GETLOADAVG' => 1, - 'AC_PROG_INSTALL' => 1, - 'AM_GNU_GETTEXT' => 1, - 'AC_CONFIG_AUX_DIR' => 1, - 'AC_HEADER_STDC' => 1, - 'AC_PROG_YACC' => 1, - 'AC_PROG_RANLIB' => 1, - 'AC_CONFIG_HEADERS' => 1, - 'AC_FUNC_STRCOLL' => 1, + 'AC_HEADER_DIRENT' => 1, 'AC_HEADER_TIME' => 1, - 'AC_FUNC_WAIT3' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AC_TYPE_OFF_T' => 1, + 'AC_FUNC_GETGROUPS' => 1, 'AC_SUBST' => 1, - 'AH_OUTPUT' => 1, - 'AC_FUNC_CHOWN' => 1, - 'AC_FUNC_LSTAT' => 1, - 'AC_PROG_CPP' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_CANONICAL_HOST' => 1, 'AC_PROG_CXX' => 1, - 'AC_HEADER_DIRENT' => 1, - 'AC_FUNC_ERROR_AT_LINE' => 1, - 'AC_FUNC_MBRTOWC' => 1, - 'AC_PATH_X' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_FUNC_OBSTACK' => 1, 'AC_FUNC_STAT' => 1, - 'm4_pattern_forbid' => 1, - 'AC_TYPE_PID_T' => 1, - 'AC_PROG_LEX' => 1, - 'AC_TYPE_OFF_T' => 1, - 'AC_PROG_CC' => 1, - 'AC_CANONICAL_SYSTEM' => 1, - 'AC_CHECK_LIB' => 1, - 'AC_FUNC_SETVBUF_REVERSED' => 1, - 'AC_CANONICAL_HOST' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_PROG_AWK' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AC_CONFIG_FILES' => 1, + 'AC_STRUCT_TIMEZONE' => 1, + 'AC_FUNC_FORK' => 1, + 'AC_FUNC_STRFTIME' => 1, + 'AC_C_VOLATILE' => 1, + 'AC_FUNC_GETLOADAVG' => 1, + 'AC_TYPE_MODE_T' => 1, + 'm4_pattern_allow' => 1, 'AC_FUNC_MMAP' => 1, - 'AM_CONDITIONAL' => 1, - 'AM_PROG_CC_C_O' => 1, - 'm4_include' => 1, + 'AC_PROG_RANLIB' => 1, 'AC_HEADER_MAJOR' => 1, - 'AC_FUNC_MKTIME' => 1, - 'AC_FUNC_GETPGRP' => 1, - 'AC_CHECK_HEADERS' => 1, - 'AC_FUNC_STRTOD' => 1, - 'AC_FUNC_MALLOC' => 1, - 'AC_HEADER_SYS_WAIT' => 1, - 'AC_FUNC_SELECT_ARGTYPES' => 1, - 'AC_FUNC_VPRINTF' => 1, - 'AC_FUNC_STRERROR_R' => 1, - 'AC_CHECK_MEMBERS' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'm4_pattern_forbid' => 1, + 'AC_PATH_X' => 1, + 'AC_TYPE_UID_T' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_PROG_INSTALL' => 1, 'AC_INIT' => 1, + 'AC_CHECK_LIB' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_HEADER_STAT' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'm4_include' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, 'AM_MAINTAINER_MODE' => 1, - 'AC_C_CONST' => 1, - 'AC_FUNC_MEMCMP' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'AC_FUNC_ALLOCA' => 1, - 'm4_pattern_allow' => 1, - 'AC_STRUCT_TIMEZONE' => 1, - 'AC_PROG_AWK' => 1, 'AC_FUNC_REALLOC' => 1, - 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, 'include' => 1, - 'AC_TYPE_SIGNAL' => 1, - 'AC_FUNC_FORK' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AC_PROG_CPP' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_C_INLINE' => 1, + 'AC_FUNC_WAIT3' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_FUNC_STRNLEN' => 1, + 'AC_FUNC_MBRTOWC' => 1, + 'AC_C_CONST' => 1, + 'AC_FUNC_SELECT_ARGTYPES' => 1, + 'AM_PROG_CC_C_O' => 1, 'AC_CONFIG_SUBDIRS' => 1, - 'AC_PROG_GCC_TRADITIONAL' => 1, - 'AC_CONFIG_FILES' => 1, - 'AC_FUNC_GETGROUPS' => 1, + 'AC_CHECK_MEMBERS' => 1, + 'AC_FUNC_STRERROR_R' => 1, + 'AC_CHECK_HEADERS' => 1, 'AC_CHECK_TYPES' => 1, - 'AC_FUNC_SETPGRP' => 1, + 'AC_FUNC_GETMNTENT' => 1, 'AC_REPLACE_FNMATCH' => 1, - 'AC_FUNC_STRFTIME' => 1, - 'AC_HEADER_STAT' => 1, - 'AC_TYPE_UID_T' => 1, - 'AC_FUNC_GETMNTENT' => 1 + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_PROG_YACC' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AC_PROG_CC' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_FUNC_UTIME_NULL' => 1, + 'AH_OUTPUT' => 1, + 'AC_PROG_LEX' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AC_PROG_MAKE_SET' => 1 } ], 'Request' ) ); diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 index 79667a4a4..1f6797199 100644 --- a/autom4te.cache/traces.0 +++ b/autom4te.cache/traces.0 @@ -886,6 +886,7 @@ m4trace:configure.in:696: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBRTOWC]) m4trace:configure.in:696: -2- AC_DEFINE_TRACE_LITERAL([HAVE_MBRLEN]) m4trace:configure.in:696: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCTOMB]) m4trace:configure.in:696: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCWIDTH]) +m4trace:configure.in:696: -2- AC_DEFINE_TRACE_LITERAL([HAVE_WCSDUP]) m4trace:configure.in:696: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MBSTATE_T]) m4trace:configure.in:696: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LANGINFO_CODESET]) m4trace:configure.in:700: -1- AC_CHECK_LIB([dl], [dlopen]) diff --git a/config.h.in b/config.h.in index ad894ec60..0780d0950 100644 --- a/config.h.in +++ b/config.h.in @@ -734,6 +734,9 @@ /* Define if you have the wait3 function. */ #undef HAVE_WAIT3 +/* Define if you have the wcsdup function. */ +#undef HAVE_WCSDUP + /* Define if you have the wctomb function. */ #undef HAVE_WCTOMB diff --git a/configure b/configure index ae1a94eb0..6dac156ba 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in for Bash 3.0, version 3.161, from autoconf version AC_ACVERSION. +# From configure.in for Bash 3.0, version 3.162, from autoconf version AC_ACVERSION. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for bash 3.0-beta1. # @@ -14614,6 +14614,85 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for wcsdup" >&5 +echo $ECHO_N "checking for wcsdup... $ECHO_C" >&6 +if test "${ac_cv_func_wcsdup+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char wcsdup (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char wcsdup (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_wcsdup) || defined (__stub___wcsdup) +choke me +#else +char (*f) () = wcsdup; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != wcsdup; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_wcsdup=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_wcsdup=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_wcsdup" >&5 +echo "${ECHO_T}$ac_cv_func_wcsdup" >&6 +if test $ac_cv_func_wcsdup = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_WCSDUP 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking for mbstate_t" >&5 echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 diff --git a/configure.in b/configure.in index 7e709b279..6ba667dbc 100644 --- a/configure.in +++ b/configure.in @@ -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.0, version 3.161, from autoconf version] AC_ACVERSION)dnl +AC_REVISION([for Bash 3.0, version 3.162, from autoconf version] AC_ACVERSION)dnl define(bashvers, 3.0) define(relstatus, beta1) diff --git a/print_cmd.c b/print_cmd.c index 631c5ccff..8381bc337 100644 --- a/print_cmd.c +++ b/print_cmd.c @@ -775,6 +775,13 @@ print_redirection_list (redirects) else hdtail = heredocs = newredir; } + else if (redirects->instruction == r_duplicating_output_word && redirects->redirector == 1) + { + /* Temporarily translate it as the execution code does. */ + redirects->instruction = r_err_and_out; + print_redirection (redirects); + redirects->instruction = r_duplicating_output_word; + } else print_redirection (redirects); diff --git a/subst.c b/subst.c index da6174ead..68c6f459e 100644 --- a/subst.c +++ b/subst.c @@ -214,7 +214,9 @@ static unsigned char *mb_getcharlens __P((char *, int)); static char *remove_upattern __P((char *, char *, int)); #if defined (HANDLE_MULTIBYTE) +# if !defined (HAVE_WCSDUP) static wchar_t *wcsdup __P((wchar_t *)); +# endif static wchar_t *remove_wpattern __P((wchar_t *, size_t, wchar_t *, int)); #endif static char *remove_pattern __P((char *, char *, int)); @@ -2966,6 +2968,8 @@ remove_upattern (param, pattern, op) } #if defined (HANDLE_MULTIBYTE) + +#if !defined (HAVE_WCSDUP) static wchar_t * wcsdup (ws) wchar_t *ws; @@ -2979,6 +2983,7 @@ wcsdup (ws) return ret; return (wcscpy (ret, ws)); } +#endif /* !HAVE_WCSDUP */ static wchar_t * remove_wpattern (wparam, wstrlen, wpattern, op) diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 72ec06a2c..3efcf32d6 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/bash/bash-current +BUILD_DIR=/usr/local/build/chet/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR -- 2.47.3