commit bash-20161111 snapshot

This commit is contained in:
Chet Ramey
2016-11-14 13:46:09 -05:00
parent 78a3f8a4ba
commit 216e2e9b8b
51 changed files with 1885 additions and 2255 deletions
+67
View File
@@ -12288,3 +12288,70 @@ subst.c
string. This can happen if the string ends with an odd number of
CTLESC chars. Fixes oob-read error reported by
op7ic \x00 <op7ica@gmail.com>
11/11
-----
configure.ac,aclocal.m4
- BASH_FUNC_SBRK: make sure sbrk actually works, instead of being just
a stub function like on several Linux distributions
lib/malloc/malloc.c
- malloc_usable_size: return the maximum number of bytes available for
a particular memory allocation (size of block allocated for it)
11/12
-----
configure.ac
- changes to make --enable-profiling work on Linux (-pg, no static link,
no -static in LDFLAGS)
Makefile.in
- changes to make --enable-profiling work on Linux (take
${PROFILE_FLAGS} out of BASE_CCFLAGS, add to CCFLAGS instead; add
BASE_LDFLAGS define that doesn't include -pg or -static; use
BASE_LDFLAGS in LDFLAGS; move ${PROFILE_FLAGS} and ${STATIC_LD} to
LDFLAGS)
tests/run-gprof
- changes to make profiling test suite with gprof work on Linux (set
GMON_OUT_PREFIX to handle multiple profiled processes per test;
change default filename to gmon.out from bash.gmon; look for
gprof output files in ${TMPDIR} instead of /tmp; handle multiple
profiling files starting with $GMON_OUT_PREFIX)
locale.c
- locale_isutf8: use locale_charset() if it's available and nl_langinfo
isn't
- locale_isutf8: add code to parse a locale specification and determine
whether the encoding is UTF-8 (or utf8) in the absence of
nl_langinfo and locale_charset
- set_default_locale: make sure to set locale_utf8locale early on
- locale_utf8locale: set via call to locale_isutf8 wherever LANG,
LC_ALL, or LC_CTYPE is set
11/13
-----
lib/readline/display.c
- rl_redisplay: handle report of potential integer overflow in
horizontal display mode from Mateusz Lenik <mlen@mlen.pl>
lib/sh/mbschr.c
- mbschr: if in a UTF-8 locale (locale_utf8locale) and we are looking
for an ASCII character, use (essentially) strchr as a shortcut
lib/sh/shmbchar.c
- utf8_{mbstrlen,mblen,mbsmbchar,mbsnlen}: UTF-8-specific replacement
functions (should also be able to use utf8_mblen in subst.c:
string_extract_verbatim)
- mbsmbchar: if locale_utf8locale is true, call utf8_mbsmbchar
- mbsmbchar: in UTF-8 locale, use utf8_mblen instead of mbrlen (not
used if earlier shortcut taken)
lib/sh/unicode.c
- u32cconv: don't use nl_langinfo early to call u32toutf8()
- u32cconv: use locale_utf8locale to set utf8locale
- u32cconv: when initializing (u32init == 0), use locale_charset, then
nl_langinfo, then stub_charset to determine the charset
- u32cconv: even if we don't have iconv, if locale_utf8locale is non-
zero, return u32toutf8
+7
View File
@@ -826,6 +826,7 @@ tests/arith4.sub f
tests/arith5.sub f
tests/arith6.sub f
tests/arith7.sub f
tests/arith8.sub f
tests/array.tests f
tests/array.right f
tests/array1.sub f
@@ -849,6 +850,7 @@ tests/array18.sub f
tests/array19.sub f
tests/array20.sub f
tests/array21.sub f
tests/array22.sub f
tests/array-at-star f
tests/array2.right f
tests/assoc.tests f
@@ -947,6 +949,8 @@ tests/dstack.tests f
tests/dstack.right f
tests/dstack2.tests f
tests/dstack2.right f
tests/dynvar.tests f
tests/dynvar.right f
tests/errors.tests f
tests/errors.right f
tests/errors1.sub f
@@ -1017,6 +1021,7 @@ tests/getopts9.sub f
tests/getopts10.sub f
tests/glob.tests f
tests/glob1.sub f
tests/glob2.sub f
tests/glob.right f
tests/globstar.tests f
tests/globstar.right f
@@ -1043,6 +1048,7 @@ tests/history1.sub f
tests/history2.sub f
tests/ifs.tests f
tests/ifs.right f
tests/ifs1.sub f
tests/ifs-posix.tests f
tests/ifs-posix.right f
tests/input-line.sh f
@@ -1203,6 +1209,7 @@ tests/run-dbg-support f
tests/run-dbg-support2 f
tests/run-dirstack f
tests/run-dollars f
tests/run-dynvar f
tests/run-errors f
tests/run-execscript f
tests/run-exp-tests f
+4 -3
View File
@@ -144,14 +144,15 @@ LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
SYSTEM_FLAGS = -DPROGRAM='"$(Program)"' -DCONF_HOSTTYPE='"$(Machine)"' -DCONF_OSTYPE='"$(OS)"' -DCONF_MACHTYPE='"$(MACHTYPE)"' -DCONF_VENDOR='"$(VENDOR)"' $(LOCALE_DEFS)
BASE_CCFLAGS = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
BASE_CCFLAGS = $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
$(DEFS) $(LOCAL_CFLAGS) $(INCLUDES)
CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
CCFLAGS = $(BASE_CCFLAGS) ${PROFILE_FLAGS} $(CPPFLAGS) $(CFLAGS)
CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
BASE_LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
LDFLAGS = ${BASE_LDFLAGS} ${PROFILE_FLAGS} ${STATIC_LD}
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
Vendored
+33
View File
@@ -1794,6 +1794,8 @@ if test "$am_cv_func_iconv" = yes; then
LIBS="$OLDLIBS"
fi
AC_CHECK_SIZEOF(wchar_t, 4)
])
dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
@@ -4191,3 +4193,34 @@ fi
AC_MSG_RESULT($bash_cv_wexitstatus_offset)
AC_DEFINE_UNQUOTED([WEXITSTATUS_OFFSET], [$bash_cv_wexitstatus_offset], [Offset of exit status in wait status word])
])
AC_DEFUN([BASH_FUNC_SBRK],
[
AC_CHECK_FUNCS_ONCE([sbrk])
if test X$ac_cv_func_sbrk = Xyes; then
AC_CACHE_CHECK([for working sbrk], [bash_cv_func_sbrk],
[AC_TRY_RUN([
#include <stdlib.h>
#include <unistd.h>
int
main(int c, char **v)
{
void *x;
x = sbrk (4096);
exit ((x == (void *)-1) ? 1 : 0);
}
], bash_cv_func_sbrk=yes, bash_cv_func_snprintf=sbrk,
[AC_MSG_WARN([cannot check working sbrk if cross-compiling])
bash_cv_func_sbrk=yes]
)])
if test $bash_cv_func_sbrk = no; then
ac_cv_func_sbrk=no
fi
fi
if test $ac_cv_func_sbrk = no; then
AC_DEFINE(HAVE_SBRK, 0,
[Define if you have a working sbrk function.])
fi
])
+3
View File
@@ -242,6 +242,9 @@
/* The number of bytes in a `long long', if we have one. */
#undef SIZEOF_LONG_LONG
/* The number of bytes in a `wchar_t', if supported */
#undef SIZEOF_WCHAR_T
/* System paths */
#define DEFAULT_MAIL_DIRECTORY "/usr/spool/mail"
Vendored
+99 -5
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac for Bash 4.4, version 4.083.
# From configure.ac for Bash 4.4, version 4.086.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 4.4-maint.
#
@@ -2645,6 +2645,7 @@ as_fn_append ac_header_list " unistd.h"
as_fn_append ac_header_list " sys/param.h"
as_fn_append ac_header_list " sys/time.h"
as_fn_append ac_func_list " alarm"
as_fn_append ac_func_list " sbrk"
as_fn_append ac_func_list " fpurge"
as_fn_append ac_func_list " __fpurge"
as_fn_append ac_func_list " snprintf"
@@ -4924,7 +4925,7 @@ fi
if test "$opt_profiling" = "yes"; then
PROFILE_FLAGS=-pg
case "$host_os" in
solaris2*) ;;
solaris2*|linux*) ;;
*) opt_static_link=yes ;;
esac
DEBUG= MALLOC_DEBUG=
@@ -4940,7 +4941,7 @@ if test "$opt_static_link" = yes; then
if test -n "$GCC" || test "$ac_cv_c_compiler_gnu" = "yes"; then
STATIC_LD="-static"
case "$host_os" in
solaris2*) ;;
solaris2*|linux*) ;;
*) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
esac
fi
@@ -4952,7 +4953,11 @@ fi
if test "X$cross_compiling" = "Xno"; then
CC_FOR_BUILD=${CC_FOR_BUILD-'$(CC)'}
CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"$CPPFLAGS"} # XXX - should it be '$(CPPFLAGS)'
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
if test X"$opt_profiling" = Xyes; then
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(BASE_LDFLAGS)'}
else
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
fi
# CFLAGS set above to default value if not passed in environment
CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
@@ -9804,7 +9809,7 @@ fi
for ac_func in dup2 eaccess fcntl getdtablesize getgroups gethostname \
getpagesize getpeername getrlimit getrusage gettimeofday \
kill killpg lstat pselect readlink sbrk select setdtablesize \
kill killpg lstat pselect readlink select setdtablesize \
setitimer tcgetpgrp uname ulimit waitpid
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -11445,6 +11450,40 @@ done
LIBS="$OLDLIBS"
fi
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5
$as_echo_n "checking size of wchar_t... " >&6; }
if ${ac_cv_sizeof_wchar_t+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default"; then :
else
if test "$ac_cv_type_wchar_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (wchar_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_wchar_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5
$as_echo "$ac_cv_sizeof_wchar_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t
_ACEOF
if test "$opt_static_link" != yes; then
@@ -14408,6 +14447,61 @@ fi
if test X$ac_cv_func_sbrk = Xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working sbrk" >&5
$as_echo_n "checking for working sbrk... " >&6; }
if ${bash_cv_func_sbrk+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check working sbrk if cross-compiling" >&5
$as_echo "$as_me: WARNING: cannot check working sbrk if cross-compiling" >&2;}
bash_cv_func_sbrk=yes
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <unistd.h>
int
main(int c, char **v)
{
void *x;
x = sbrk (4096);
exit ((x == (void *)-1) ? 1 : 0);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
bash_cv_func_sbrk=yes
else
bash_cv_func_snprintf=sbrk
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_sbrk" >&5
$as_echo "$bash_cv_func_sbrk" >&6; }
if test $bash_cv_func_sbrk = no; then
ac_cv_func_sbrk=no
fi
fi
if test $ac_cv_func_sbrk = no; then
$as_echo "#define HAVE_SBRK 0" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the existence of strsignal" >&5
$as_echo_n "checking for the existence of strsignal... " >&6; }
if ${bash_cv_have_strsignal+:} false; then :
+12 -5
View File
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 4.4, version 4.083])dnl
AC_REVISION([for Bash 4.4, version 4.086])dnl
define(bashvers, 4.4)
define(relstatus, maint)
@@ -472,7 +472,7 @@ dnl these must come after the test for cc/gcc
if test "$opt_profiling" = "yes"; then
PROFILE_FLAGS=-pg
case "$host_os" in
solaris2*) ;;
solaris2*|linux*) ;;
*) opt_static_link=yes ;;
esac
DEBUG= MALLOC_DEBUG=
@@ -488,7 +488,7 @@ if test "$opt_static_link" = yes; then
if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
STATIC_LD="-static"
case "$host_os" in
solaris2*) ;;
solaris2*|linux*) ;;
*) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
esac
fi
@@ -500,7 +500,11 @@ fi
if test "X$cross_compiling" = "Xno"; then
CC_FOR_BUILD=${CC_FOR_BUILD-'$(CC)'}
CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"$CPPFLAGS"} # XXX - should it be '$(CPPFLAGS)'
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
if test X"$opt_profiling" = Xyes; then
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(BASE_LDFLAGS)'}
else
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
fi
# CFLAGS set above to default value if not passed in environment
CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
@@ -770,7 +774,7 @@ AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
dnl checks for system calls
AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
getpagesize getpeername getrlimit getrusage gettimeofday \
kill killpg lstat pselect readlink sbrk select setdtablesize \
kill killpg lstat pselect readlink select setdtablesize \
setitimer tcgetpgrp uname ulimit waitpid)
AC_REPLACE_FUNCS(rename)
@@ -980,6 +984,9 @@ BASH_STRUCT_WEXITSTATUS_OFFSET
BASH_CHECK_TYPE_STRUCT_TIMESPEC
BASH_STAT_TIME
dnl checks for system calls
BASH_FUNC_SBRK
dnl presence and behavior of C library functions
BASH_FUNC_STRSIGNAL
BASH_FUNC_OPENDIR_CHECK
+1 -2
View File
@@ -4373,7 +4373,6 @@ run_builtin:
break;
case EX_DISKFALLBACK:
/* XXX - experimental */
itrace("execute_simple_command: fallback to file system");
executing_builtin = old_builtin;
executing_command_builtin = old_command_builtin;
builtin = 0;
@@ -4988,7 +4987,7 @@ execute_subshell_builtin_or_function (words, redirects, builtin, var,
else if (r == EX_DISKFALLBACK)
{
char *command_line;
itrace("execute_subshell_builtin_or_function: fall back to disk command");
command_line = savestring (the_printed_command_except_trap ? the_printed_command_except_trap : "");
r = execute_disk_command (words, (REDIRECT *)0, command_line,
-1, -1, async, (struct fd_bitmap *)0, flags|CMD_NO_FORK);
+3 -1
View File
@@ -974,6 +974,7 @@ cleanup_dead_jobs ()
{
register int i;
int os;
PROCESS *discard;
if (js.j_jobslots == 0 || jobs_list_frozen)
return;
@@ -998,8 +999,9 @@ cleanup_dead_jobs ()
if (last_procsub_child && last_procsub_child->running == PS_DONE)
{
bgp_add (last_procsub_child->pid, process_exit_status (last_procsub_child->status)); /* XXX */
discard_pipeline (last_procsub_child);
discard = last_procsub_child;
last_procsub_child = (PROCESS *)NULL;
discard_pipeline (discard);
}
#endif
+29
View File
@@ -1157,6 +1157,35 @@ posix_memalign (memptr, alignment, size)
return ENOMEM;
}
size_t
malloc_usable_size (mem)
void *mem;
{
register union mhead *p;
register char *ap;
register int maxbytes;
if ((ap = (char *)mem) == 0)
return 0;
/* Find the true start of the memory block to discover which bin */
p = (union mhead *) ap - 1;
if (p->mh_alloc == ISMEMALIGN)
{
ap -= p->mh_nbytes;
p = (union mhead *) ap - 1;
}
/* XXX - should we return 0 if ISFREE? */
maxbytes = binsize(p->mh_index);
/* So the usable size is the maximum number of bytes in the bin less the
malloc overhead */
maxbytes -= MOVERHEAD + MSLOP;
return (maxbytes);
}
#if !defined (NO_VALLOC)
/* This runs into trouble with getpagesize on HPUX, and Multimax machines.
Patching out seems cleaner than the ugly fix needed. */
+1 -1
View File
@@ -1304,7 +1304,7 @@ rl_redisplay ()
right edge of the screen. If LMARGIN is 0, we need to take the
wrap offset into account. */
t = lmargin + M_OFFSET (lmargin, wrap_offset) + _rl_screenwidth;
if (t < out)
if (t > 0 && t < out)
line[t - 1] = '>';
if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin)
+12
View File
@@ -28,9 +28,18 @@
#include "shmbutil.h"
extern int locale_mb_cur_max;
extern int locale_utf8locale;
#undef mbschr
static inline char *
utf8_mbschr (s, c)
const char *s;
int c;
{
return strchr (s, c); /* for now */
}
/* In some locales, the non-first byte of some multibyte characters have
the same value as some ascii character. Faced with these strings, a
legacy strchr() might return the wrong value. */
@@ -49,6 +58,9 @@ mbschr (s, c)
mbstate_t state;
size_t strlength, mblength;
if (locale_utf8locale && c < 0x80)
return (utf8_mbschr (s, c)); /* XXX */
/* The locale encodings with said weird property are BIG5, BIG5-HKSCS,
GBK, GB18030, SHIFT_JIS, and JOHAB. They exhibit the problem only
when c >= 0x30. We can therefore use the faster bytewise search if
+143 -1
View File
@@ -20,9 +20,15 @@
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <shmbutil.h>
#include <shmbchar.h>
#ifndef errno
extern int errno;
#endif
#if IS_BASIC_ASCII
/* Bit table of characters in the ISO C "basic character set". */
@@ -37,6 +43,106 @@ const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] =
#endif /* IS_BASIC_ASCII */
extern int locale_utf8locale;
/* We can optimize this if we know the locale is UTF-8, but needs to handle
malformed byte sequences. */
static inline size_t
utf8_mbstrlen(s)
const char *s;
{
size_t num = 0;
register unsigned char c;
while ((c = *s++))
/* bytes 0xc0 through 0xff are first byte of multi-byte sequence */
if ((c & 0xc0) != 0x80) /* skip continuation bytes */
++num;
return (num);
}
/* Adapted from GNU libutf8 */
static inline int
utf8_mblen (s, n)
const char *s;
int n;
{
unsigned char c;
if (s == 0)
return 0;
else if (n == 0)
return -1;
c = (unsigned char) *s;
if (c < 0x80)
return (c != 0);
else if (c < 0xc0)
goto return_error;
else
{
const char *start = s;
size_t count;
int check_unsafe;
if (c < 0xe0)
{
count = 1;
if (c < 0xc2)
goto return_error;
check_unsafe = 0;
}
else if (c < 0xf0)
{
count = 2;
check_unsafe = (c == 0xe0);
}
#if SIZEOF_WCHAR_T == 4
else if (c < 0xf8)
{
count = 3;
check_unsafe = (c == 0xe0);
}
else if (c < 0xfc)
{
count = 4;
check_unsafe = (c == 0xf8);
}
else if (c < 0xfe)
{
count = 5;
check_unsafe = (c == 0xfc);
}
#endif
else
goto return_error;
if (n <= count)
return -1;
s++;
c = (unsigned char) *s++ ^ 0x80;
if (c >= 0x40)
goto return_error;
if (--count > 0)
{
if (check_unsafe && ((c >> (6 - count)) == 0))
goto return_error;
do
{
c = (unsigned char) *s++ ^ 0x80;
if (c >= 0x40)
goto return_error;
}
while (--count > 0);
}
return s - start;
}
return_error:
errno = EILSEQ;
return -1;
}
/* Count the number of characters in S, counting multi-byte characters as a
single character. */
size_t
mbstrlen (s)
const char *s;
@@ -64,7 +170,21 @@ mbstrlen (s)
return nc;
}
static inline char *
utf8_mbsmbchar (str)
const char *str;
{
register char *s;
for (s = (char *)str; *s; s++)
if ((*s & 0xc0) == 0x80)
return s;
return (0);
}
/* Return pointer to first multibyte char in S, or NULL if none. */
/* XXX - if we know that the locale is UTF-8, we can just check whether or
not any byte has the eighth bit turned on */
char *
mbsmbchar (s)
const char *s;
@@ -74,13 +194,19 @@ mbsmbchar (s)
mbstate_t mbs = { 0 };
int mb_cur_max;
if (locale_utf8locale)
return (utf8_mbsmbchar (s)); /* XXX */
mb_cur_max = MB_CUR_MAX;
for (t = (char *)s; *t; t++)
{
if (is_basic (*t))
continue;
clen = mbrlen (t, mb_cur_max, &mbs);
if (locale_utf8locale) /* not used if above code active */
clen = utf8_mblen (t, mb_cur_max);
else
clen = mbrlen (t, mb_cur_max, &mbs);
if (clen == 0)
return 0;
@@ -93,6 +219,22 @@ mbsmbchar (s)
return 0;
}
static inline int
utf_mbsnlen(src, srclen, maxlen)
const char *src;
size_t srclen;
int maxlen;
{
register int sind, count;
for (sind = count = 0; src[sind] && sind <= maxlen; sind++)
{
if ((src[sind] & 0xc0) != 0x80)
count++;
}
return (count);
}
int
sh_mbsnlen(src, srclen, maxlen)
const char *src;
+17 -22
View File
@@ -55,6 +55,8 @@ extern const char *locale_charset __P((void));
extern char *get_locale_var __P((char *));
#endif
extern int locale_utf8locale;
static int u32init = 0;
static int utf8locale = 0;
#if defined (HAVE_ICONV)
@@ -265,28 +267,20 @@ u32cconv (c, s)
return n;
#endif
#if HAVE_NL_LANGINFO
codeset = nl_langinfo (CODESET);
if (STREQ (codeset, "UTF-8"))
{
n = u32toutf8 (c, s);
return n;
}
#endif
#if HAVE_ICONV
/* this is mostly from coreutils-8.5/lib/unicodeio.c */
if (u32init == 0)
{
# if HAVE_LOCALE_CHARSET
charset = locale_charset (); /* XXX - fix later */
# else
charset = stub_charset ();
# endif
if (STREQ (charset, "UTF-8"))
utf8locale = 1;
else
utf8locale = locale_utf8locale;
if (utf8locale == 0)
{
#if HAVE_LOCALE_CHARSET
charset = locale_charset ();
#elif HAVE_NL_LANGINFO
charset = nl_langinfo (CODESET);
#else
charset = stub_charset ();
#endif
localconv = iconv_open (charset, "UTF-8");
if (localconv == (iconv_t)-1)
/* We assume ASCII when presented with an unknown encoding. */
@@ -295,6 +289,8 @@ u32cconv (c, s)
u32init = 1;
}
/* NL_LANGINFO and locale_charset used when setting locale_utf8locale */
/* If we have a UTF-8 locale, convert to UTF-8 and return converted value. */
n = u32toutf8 (c, s);
if (utf8locale)
@@ -315,12 +311,8 @@ u32cconv (c, s)
if (iconv (localconv, (ICONV_CONST char **)&iptr, &sn, &optr, &obytesleft) == (size_t)-1)
{
#if 1
/* You get ISO C99 escape sequences if iconv fails */
n = u32tocesc (c, s);
#else
/* You get UTF-8 if iconv fails */
#endif
return n;
}
@@ -332,7 +324,10 @@ u32cconv (c, s)
return (optr - obuf);
#endif /* HAVE_ICONV */
n = u32tocesc (c, s); /* fallback is ISO C99 escape sequences */
if (locale_utf8locale)
n = u32toutf8 (c, s);
else
n = u32tocesc (c, s); /* fallback is ISO C99 escape sequences */
return n;
}
#else
+37 -7
View File
@@ -1,6 +1,6 @@
/* locale.c - Miscellaneous internationalization functions. */
/* Copyright (C) 1996-2009,2012 Free Software Foundation, Inc.
/* Copyright (C) 1996-2009,2012,2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -43,7 +43,7 @@
extern int errno;
#endif
int locale_utf8locale; /* unused for now */
int locale_utf8locale; /* set but unused for now */
int locale_mb_cur_max; /* value of MB_CUR_MAX for current locale (LC_CTYPE) */
extern int dump_translatable_strings, dump_po_strings;
@@ -84,6 +84,7 @@ set_default_locale ()
textdomain (PACKAGE);
locale_mb_cur_max = MB_CUR_MAX;
locale_utf8locale = locale_isutf8 (default_locale);
}
/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC and
@@ -103,6 +104,7 @@ set_default_locale_vars ()
setlocale (LC_CTYPE, lc_all);
locale_setblanks ();
locale_mb_cur_max = MB_CUR_MAX;
locale_utf8locale = locale_isutf8 (lc_all);
u32reset ();
}
# endif
@@ -203,6 +205,9 @@ set_locale_var (var, value)
}
locale_setblanks ();
locale_mb_cur_max = MB_CUR_MAX;
/* if LC_ALL == "", reset_locale_vars has already called this */
if (*lc_all && x)
locale_utf8locale = locale_isutf8 (lc_all);
u32reset ();
return r;
#else
@@ -219,6 +224,9 @@ set_locale_var (var, value)
x = setlocale (LC_CTYPE, get_locale_var ("LC_CTYPE"));
locale_setblanks ();
locale_mb_cur_max = MB_CUR_MAX;
/* if setlocale() returns NULL, the locale is not changed */
if (x)
locale_utf8locale = locale_isutf8 (x);
u32reset ();
}
# endif
@@ -327,15 +335,16 @@ get_locale_var (var)
static int
reset_locale_vars ()
{
char *t;
char *t, *x;
#if defined (HAVE_SETLOCALE)
if (lang == 0 || *lang == '\0')
maybe_make_export_env (); /* trust that this will change environment for setlocale */
if (setlocale (LC_ALL, lang ? lang : "") == 0)
return 0;
x = 0;
# if defined (LC_CTYPE)
t = setlocale (LC_CTYPE, get_locale_var ("LC_CTYPE"));
x = setlocale (LC_CTYPE, get_locale_var ("LC_CTYPE"));
# endif
# if defined (LC_COLLATE)
t = setlocale (LC_COLLATE, get_locale_var ("LC_COLLATE"));
@@ -352,8 +361,9 @@ reset_locale_vars ()
locale_setblanks ();
locale_mb_cur_max = MB_CUR_MAX;
if (x)
locale_utf8locale = locale_isutf8 (x);
u32reset ();
#endif
return 1;
}
@@ -547,18 +557,38 @@ locale_setblanks ()
}
}
/* Parse a locale specification
language[_territory][.codeset][@modifier][+special][,[sponsor][_revision]]
and return TRUE if the codeset is UTF-8 or utf8 */
static int
locale_isutf8 (lspec)
char *lspec;
{
char *cp;
char *cp, *encoding;
#if HAVE_LANGINFO_CODESET
cp = nl_langinfo (CODESET);
return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8"));
#elif HAVE_LOCALE_CHARSET
cp = locale_charset ();
return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8"));
#else
/* Take a shot */
return (strstr (lspec, "UTF-8") || strstr (lspec, "utf8"));
for (cp = lspec; *cp && *cp != '@' && *cp != '+' && *cp != ','; cp++)
{
if (*cp == '.')
{
for (encoding = ++cp; *cp && *cp != '@' && *cp != '+' && *cp != ','; cp++)
;
/* The encoding (codeset) is the substring between encoding and cp */
if ((cp - encoding == 5 && STREQN (encoding, "UTF-8", 5)) ||
(cp - encoding == 4 && STREQN (encoding, "utf8", 4)))
return 1;
else
return 0;
}
}
return 0;
#endif
}
+725 -1488
View File
File diff suppressed because it is too large Load Diff
+344 -688
View File
File diff suppressed because it is too large Load Diff
+11 -4
View File
@@ -242,14 +242,21 @@ efg
e
abcdefg
efg
0
0
0
0
0
0
0
8 12
./arith.tests: line 294: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
./arith.tests: line 298: a b: syntax error in expression (error token is "b")
./arith.tests: line 299: ((: a b: syntax error in expression (error token is "b")
./arith.tests: line 297: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
./arith.tests: line 301: a b: syntax error in expression (error token is "b")
./arith.tests: line 302: ((: a b: syntax error in expression (error token is "b")
42
42
42
42
42
42
./arith.tests: line 310: b[c]d: syntax error in expression (error token is "d")
./arith.tests: line 313: b[c]d: syntax error in expression (error token is "d")
+3
View File
@@ -283,6 +283,9 @@ ${THIS_SH} ./arith6.sub
# part of word expansions such as substring extraction
${THIS_SH} ./arith7.sub
# problems with evaluation of conditional expressions
${THIS_SH} ./arith8.sub
x=4
y=7
+37
View File
@@ -0,0 +1,37 @@
# problems with evaluation of wrong terms in conditional expressions through
# bash-4.4
a=0 x="a=1"
((0?x:0))
echo $a
unset a x
a=0 x="a=1"
((1?0:x))
echo $a
unset a x
a=0 x="a=1"
((0?(x):0))
echo $a
unset a x
a=0 x="a=1"
((0?$x:0))
echo $a
unset a x
a=0 x="a=1"
((0&&x))
echo $a
unset a x
a=0 x="a=1"
((1||x))
echo $a
unset a x
a=0
((0?arr[a=1]:0))
echo $a
unset a
+18
View File
@@ -502,3 +502,21 @@ unset
declare -a a=()
declare -A A=()
declare -a foo=([0]="1" [1]="(4 5 6)" [2]="3")
a1
argv[1] = <>
argv[2] = <>
a2
argv[1] = <>
a3
argv[1] = <>
argv[2] = <x>
a4
argv[1] = <y>
p1
argv[1] = <>
argv[2] = <>
p2
argv[1] = <>
argv[2] = <x>
p3
argv[1] = <y>
+2 -1
View File
@@ -248,7 +248,7 @@ ${THIS_SH} ./array3.sub
${THIS_SH} ./array4.sub
set +u
cd /tmp
cd ${TMPDIR:=/tmp}
touch 1=bar
foo=([10]="bar")
@@ -397,3 +397,4 @@ ${THIS_SH} ./array18.sub
${THIS_SH} ./array19.sub
${THIS_SH} ./array20.sub
${THIS_SH} ./array21.sub
${THIS_SH} ./array22.sub
+34
View File
@@ -0,0 +1,34 @@
# This isn't perfect behavior, but it establishes a baseline and will provide
# a way to detect behavior changes
echo a1
a[0]= a[1]=; recho "${a[@]:-y}"
unset a
echo a2
a[1]=; recho "${a[@]:-y}"
unset a
echo a3
a[0]= a[1]=x; recho "${a[@]:-y}"
unset a
echo a4
a[0]= a[1]=x; recho ${a[@]:+y}
unset a
echo p1
set '' ''
recho "${@:-y}"
shift $#
echo p2
set '' x
recho "${@:-y}"
shift $#
echo p3
set '' x
recho ${@:+y}
+1 -1
View File
@@ -4,7 +4,7 @@
mkdir $TMPDIR/bash-test-$$
cd $TMPDIR/bash-test-$$
trap "cd / ; rm -rf $TMPDIR/bash-test-$$" 0 1 2 3 6 15
trap "cd $OLDPWD ; rm -rf $TMPDIR/bash-test-$$" 0 1 2 3 6 15
touch '[3]=abcde'
+1 -1
View File
@@ -107,7 +107,7 @@ unset flix wheat
# TEST - index expansion: no word splitting or globbing
typeset -A wheat
cd /tmp
cd ${TMPDIR:=/tmp}
touch '[sfiri]'
wheat=([s*]=6 [foo bar]=flix )
+2
View File
@@ -28,3 +28,5 @@
[[ ']' =~ [']'] ]] && echo ok 11
[[ a =~ ['a]'] ]] || echo ok 12
[[ "\\" =~ [^]"."] ]] || echo unexpected
+3
View File
@@ -1,3 +1,4 @@
wdir=$PWD
cd /
echo expect '~1'
@@ -31,3 +32,5 @@ dirs -v -1
echo these lines should be the same
dirs -0
echo ~-0 ${DIRSTACK[NDIRS]}
cd "$wdir"
+7
View File
@@ -0,0 +1,7 @@
BASHPID ok
BASH_ARGV0 ok
BASH_ARGV0 ok
SECONDS ok
EPOCHSECONDS ok
EPOCHREALTIME ok
echo $BASH_COMMAND
+77
View File
@@ -0,0 +1,77 @@
# specvar -- test some of the dynamic variables
# BASHPID
pid=$$
bpid=$BASHPID
subpid=$( (echo $BASHPID) )
if [ "$bpid" -ne "$subpid" ]; then echo BASHPID ok; fi
# BASH_ARGV0
BASH_ARGV0=hello
case $0 in
hello) echo BASH_ARGV0 ok ;;
*) echo "BASH_ARGV0 mismatch: $BASH_ARGV0 ($0)" >&2 ;;
esac
setarg0()
{
BASH_ARGV0="$1"
}
setarg0 arg0
case $0 in
arg0) echo BASH_ARGV0 ok ;;
*) echo "BASH_ARGV0 mismatch: $BASH_ARGV0 ($0)" >&2 ;;
esac
# SECONDS
before=$SECONDS
sleep 2
after=$SECONDS
if (( $after > $before )); then echo SECONDS ok; fi
unset before after
# EPOCHSECONDS
# not exact, but should work
now1=$(perl -e 'print time')
now2=$EPOCHSECONDS
case $now1 in
$now2) echo EPOCHSECONDS ok ;;
*) echo "current time via perl and EPOCHSECONDS possible mismatch|$now1|$now2" >&2 ;;
esac
unset now1 now2
LC_ALL=C # force decimal point to `.'
now1=$EPOCHREALTIME
now2=$EPOCHREALTIME
sec1=${now1%%.*}
sec2=${now2%%.*}
msec1=${now1##*.}
msec2=${now2##*.}
# cut off leading zeros
shopt -s extglob
msec1=${msec1##*(0)}
msec2=${msec2##*(0)}
dsec=$(( $sec2 - $sec1 ))
dmsec=$(( $msec2 - $msec1 ))
if (( $dmsec < 0 )); then
dmsec=$(( dmsec + 1000000 ))
dsec=$(( desc - 1 ))
fi
# not a real test, but ok for a start
if (( $dmsec < 1000000 )); then echo EPOCHREALTIME ok; fi
${THIS_SH} -c 'echo $BASH_COMMAND'
# FUNCNAME tested in func.tests
# RANDOM tested in varenv.sh
# LINENO tested in dbg-support
+3
View File
@@ -18,3 +18,6 @@ chmod 755 testb/foo
PATH=$TMPDIR/testa:$TMPDIR/testb $THIS_SH -c foo
rm -rf testa testb
cd $OLDPWD
exit 0
+1 -1
View File
@@ -12,5 +12,5 @@ echo a!(x)
echo a*?(x)
echo a?(x)
builtin cd /
builtin cd $OLDPWD
rm -rf $TESTDIR
+1 -1
View File
@@ -19,7 +19,7 @@ echo @(*|.!(|.)) # wrong, adds . and ..
echo @(*|@(f)) # ??
echo @(*|@(ff))
cd /
cd $OLDPWD
rm -rf $GTDIR
[[ a = a*?(/)b ]] && echo bad match 1
+15 -1
View File
@@ -1,4 +1,18 @@
foo/bar foobar/bar
ok 1
ok 2
ok 3
ok 4
ok 5
b
argv[1] = <A£\B>
argv[1] = <A>
argv[1] = <B>
argv[1] = <a£\b>
0000000 141 243 134 142
0000004
ok 6
ok 7
argv[1] = <a>
argv[2] = <abc>
argv[3] = <abd>
@@ -13,7 +27,7 @@ argv[2] = <abc>
argv[3] = <abd>
argv[4] = <abe>
tmp/l1 tmp/l2 tmp/*4 tmp/l3
./glob.tests: line 44: no match: tmp/*4
./glob.tests: line 45: no match: tmp/*4
argv[1] = <bdir/>
argv[1] = <*>
argv[1] = <a*>
+1
View File
@@ -9,6 +9,7 @@ expect()
# First, a test that bash-2.01.1 fails
${THIS_SH} ./glob1.sub
${THIS_SH} ./glob2.sub
MYDIR=$PWD # save where we are
+5 -2
View File
@@ -1,7 +1,10 @@
# bash-2.01.1 failed this test
FN=/tmp/bash-glob.$$
: ${TMPDIR:=/var/tmp}
FN=$TMPDIR/bash-glob.$$
mkdir $FN
cd $FN
mkdir foo
mkdir foobar
touch foo/bar
@@ -10,5 +13,5 @@ chmod 311 foo foobar
echo f*/bar
chmod 777 foo foobar
cd /
cd $OLDPWD
rm -rf $FN
+42
View File
@@ -0,0 +1,42 @@
var='ab\'
case $var in
ab\\) echo ok 1;;
*) echo bad 1;;
esac
case $var in
$var) echo ok 2;;
*) echo bad 2;;
esac
case $var in
'ab\') echo ok 3;;
*) echo bad 3;;
esac
[[ $var = $var ]] && echo ok 4
[[ $var = $'ab\134' ]] && echo ok 5
LC_ALL=zh_HK.big5hkscs
read a b c <<< $'\u3b1 b c\n'
echo $b
unset a b c
export alpha=$'\u3b1'
printf -v v 'A%sB' "$alpha"
recho "$v"
IFS=$alpha read a b c <<<"$v"
recho "$a"
recho "$b"
unset a b v
recho "a${alpha}b"
printf "%s" "a${alpha}b" | LC_ALL=C od -b
a=$'\u3b1'
[[ $a = $a ]] && echo ok 6
LC_ALL=zh_HK.big5hkscs ${THIS_SH} -c $'[[ \u3b1 = \u3b1 ]]' && echo ok 7
+2 -1
View File
@@ -1,5 +1,6 @@
olddir=$PWD
EMPTY=/tmp/empty
: ${TMPDIR:=/var/tmp}
EMPTY=$TMPDIR/empty
shopt -s globstar
s()
+6 -6
View File
@@ -59,13 +59,13 @@ qux
bar
qux
abc def geh
./heredoc3.sub: line 9: warning: here-document at line 7 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 10: warning: here-document at line 8 delimited by end-of-file (wanted `EOF')
= here is the text =
./heredoc3.sub: line 15: warning: here-document at line 13 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 16: warning: here-document at line 14 delimited by end-of-file (wanted `EOF')
this paren ) is not a problem
./heredoc3.sub: line 21: warning: here-document at line 19 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 22: warning: here-document at line 20 delimited by end-of-file (wanted `EOF')
these balanced parens ( ) are not a problem
./heredoc3.sub: line 27: warning: here-document at line 25 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 28: warning: here-document at line 26 delimited by end-of-file (wanted `EOF')
quoted balanced parens \( ) are not a problem either
more text in a subshell
some more text in a different subshell
@@ -82,8 +82,8 @@ end helloEND
hello
\END
end hello<NL>\END
./heredoc3.sub: line 78: warning: here-document at line 76 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 79: syntax error: unexpected end of file
./heredoc3.sub: line 85: warning: here-document at line 83 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 86: syntax error: unexpected end of file
comsub here-string
./heredoc.tests: line 105: warning: here-document at line 103 delimited by end-of-file (wanted `EOF')
hi
+7
View File
@@ -1,4 +1,5 @@
SAVEPWD=$PWD
: ${TMPDIR:=/tmp}
cd $TMPDIR || echo "heredoc3.sub: cannot cd to $TMPDIR" >&2
text=$(cat <<EOF
@@ -71,6 +72,12 @@ hello
END
echo end 'hello<NL>\END'
# gprof
if [ -n "$GMON_OUT_PREFIX" ]; then
mv ${GMON_OUT_PREFIX}.[0-9]* "$SAVEPWD" >/dev/null 2>&1
fi
cd "$SAVEPWD"
# this has to be last -- results in a syntax error
# doesn't currently parse because EOF is not on a line by itself -- should it?
(cat <<EOF
+2
View File
@@ -8,3 +8,5 @@ a:b:c:d:e
a:b:c:d:e
a b c d e
a b c d e
argv[1] = <file>
argv[1] = <*>
+2
View File
@@ -59,3 +59,5 @@ IFS=: export x
echo $x
IFS="$DEFIFS"
${THIS_SH} ./ifs1.sub
+14
View File
@@ -0,0 +1,14 @@
: ${TMPDIR:=/tmp}
dir=bashtest-$$
mkdir $TMPDIR/$dir || exit 1
touch $TMPDIR/$dir/file || exit 2
cd $TMPDIR/$dir || exit 3
IFS='?*[]'
recho *
recho "*"
cd $OLDPWD
rm -rf $TMPDIR/$dir
+2 -2
View File
@@ -6,7 +6,7 @@ SECS=1275250155
export TZ=EST5EDT
case $SHELLSTART in
*s*) SHELLSTART=$(perl -e 'print time') ; DATESECS=false ;; # take a shot
*s*) SHELLSTART=$EPOCHSECONDS ; DATESECS=false ;; # take a shot
*) DATESECS=true ;;
esac
@@ -15,7 +15,7 @@ printf "%(abde)Z\n" -1
printf "%(%e-%b-%Y %T)T\n" $SECS
printf -v v1 "%(%e-%b-%Y %T)T\n" $( $DATESECS && date +%s || perl -e 'print time')
printf -v v1 "%(%e-%b-%Y %T)T\n" $( $DATESECS && date +%s || echo $EPOCHSECONDS )
printf -v v2 "%(%e-%b-%Y %T)T\n" -1
case $v1 in
+2
View File
@@ -6,3 +6,5 @@ pwd
echo $?
echo $?
echo $?
cd $OLDPWD
+2
View File
@@ -56,4 +56,6 @@ exec 0<&7
exec 7<&-
rm -f infile
cd $OLDPWD
exit 0
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./dynvar.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} dynvar.right && rm -f ${BASH_TSTOUT}
+20 -11
View File
@@ -18,15 +18,18 @@ export PATH
: ${THIS_SH:=../bash}
export THIS_SH
GPROF="gprof"
rm -f gmon.sum
${THIS_SH} ./version
rm -f "$BASH_TSTOUT"
# prime the pump; gprof complains if gmon.sum is empty
[ -f bash.gmon ] && gprof -s ${THIS_SH} bash.gmon >/dev/null
# prime the pump; ${GPROF} complains if gmon.sum is empty
[ -f gmon.out ] && ${GPROF} -s ${THIS_SH} gmon.out >/dev/null
export GMON_OUT_PREFIX=bash
echo Any output from any test, unless otherwise noted, indicates a possible anomaly
for x in run-*
@@ -35,25 +38,31 @@ do
$0|run-all|run-minimal|run-gprof) ;;
*.orig|*~) ;;
*) echo $x ; sh $x
if [ -f /tmp/bash.gmon ]; then
if [ -f bash.gmon ]; then
gprof -s ${THIS_SH} gmon.sum bash.gmon /tmp/bash.gmon >/dev/null
if [ -f $TMPDIR/gmon.out ]; then
if [ -f gmon.out ]; then
${GPROF} -s ${THIS_SH} gmon.sum ${GMON_OUT_PREFIX}.[0-9]* $TMPDIR/${GMON_OUT_PREFIX}.[0-9]* >/dev/null
else
gprof -s ${THIS_SH} gmon.sum /tmp/bash.gmon >/dev/null
${GPROF} -s ${THIS_SH} gmon.sum $TMPDIR/${GMON_OUT_PREFIX}.[0-9]* >/dev/null
fi
else
gprof -s ${THIS_SH} gmon.sum bash.gmon >/dev/null
${GPROF} -s ${THIS_SH} gmon.sum ${GMON_OUT_PREFIX}.[0-9]* >/dev/null
fi
rm -f /tmp/bash.gmon bash.gmon
rm -f $TMPDIR/${GMON_OUT_PREFIX}.[0-9]* ${GMON_OUT_PREFIX}.[0-9]*
;;
esac
done
gprof -s ${THIS_SH} gmon.sum ./-specialname.gmon ./ohio-state.gmon > /dev/null
rm -f ./-specialname.gmon ./ohio-state.gmon
if [ -f ./-specialname.gmon ]; then
${GPROF} -s ${THIS_SH} gmon.sum ./-specialname.gmon > /dev/null
rm -f ./-specialname.gmon
fi
if [ -f ./ohio-state.gmon ]; then
${GPROF} -s ${THIS_SH} gmon.sum ./ohio-state.gmon > /dev/null
rm -f ./ohio-state.gmon
fi
if [ -f specialname.gmon ]; then
gprof -s ${THIS_SH} gmon.sum ./specialname.gmon > /dev/null
${GPROF} -s ${THIS_SH} gmon.sum ./specialname.gmon > /dev/null
rm -f specialname.gmon
fi
+2
View File
@@ -41,6 +41,8 @@ do
run-ifs-tests|run-input-test|run-invert|run-more-exp|run-nquote) echo $x ; sh $x ;;
run-ifs-posix|run-posix2|run-posixpat|run-posixpipe) echo $x ; sh $x ;;
run-precedence|run-quote|run-read|run-rhs-exp|run-strip|run-tilde) echo $x ; sh $x ;;
run-dynvar) echo $x ; sh $x ;;
;;
*) ;;
esac
rm -f "$BASH_TSTOUT"
+4
View File
@@ -1,3 +1,4 @@
wdir=$PWD
# this is needed because posix mode restricts tilde expansion to assignment
# statements preceding a command, instead of the default of expanding all
# assignment statements on the line (e.g., after `export'). Without this,
@@ -69,3 +70,6 @@ esac
USER=root # should exist just about everywhere
echo ~$USER
cd "$wdir"
exit 0
+3
View File
@@ -16,3 +16,6 @@ eval "$(type foo | sed 1d)"
foo
rm -f a b c
cd $OLDPWD
exit 0
+14
View File
@@ -1516,6 +1516,8 @@ get_bash_argv0 (var)
return var;
}
static char *static_shell_name = 0;
static SHELL_VAR *
assign_bash_argv0 (var, value, unused, key)
SHELL_VAR *var;
@@ -1523,8 +1525,20 @@ assign_bash_argv0 (var, value, unused, key)
arrayind_t unused;
char *key;
{
size_t vlen;
if (value == 0)
return var;
FREE (dollar_vars[0]);
dollar_vars[0] = savestring (value);
/* Need these gyrations because shell_name isn't dynamically allocated */
vlen = STRLEN (value);
static_shell_name = xrealloc (static_shell_name, vlen + 1);
strcpy (static_shell_name, value);
shell_name = static_shell_name;
return var;
}