summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2021-07-06 15:35:08 -0400
committerChet Ramey <chet.ramey@case.edu>2021-07-06 15:35:08 -0400
commit5a0e5b7b2862394cefccb919cddabf24f0ab4730 (patch)
tree82c2a11a2f481031d273fb59e5d76d216313fcc4
parent3fb16fce322266681faef39c11e3069437caadd9 (diff)
downloadbash-5a0e5b7b2862394cefccb919cddabf24f0ab4730.tar.gz
optimization changes; makefile changes to make specifying CFLAGS less annoying; print completions reusably
-rw-r--r--CWRU/CWRU.chlog52
-rw-r--r--Makefile.in3
-rw-r--r--builtins/Makefile.in5
-rw-r--r--builtins/complete.def10
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac18
-rw-r--r--lib/glob/Makefile.in3
-rw-r--r--lib/malloc/Makefile.in3
-rw-r--r--lib/readline/Makefile.in3
-rw-r--r--lib/readline/bind.c25
-rw-r--r--lib/sh/Makefile.in3
-rw-r--r--lib/sh/casemod.c10
-rw-r--r--lib/tilde/Makefile.in3
-rw-r--r--parse.y4
-rw-r--r--subst.c3
-rw-r--r--support/Makefile.in8
-rw-r--r--tests/extglob7.sub2
17 files changed, 135 insertions, 40 deletions
diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog
index 3d50815..ee168b9 100644
--- a/CWRU/CWRU.chlog
+++ b/CWRU/CWRU.chlog
@@ -10644,3 +10644,55 @@ parse.y
subst.c
- skip_matched_pair: make sure to pass the SX_COMPLETE flag to
extract_delimited_string
+
+ 6/28
+ ----
+
+lib/readline/bind.c
+ - rl_trim_arg_from_keyseq: handle rl_vi_arg_digit if VI_MODE is
+ defined. Report and fix from Koichi Murase <myoga.murase@gmail.com>
+ - rl_trim_arg_from_keyseq: rework to handle case where the digit
+ argument is given as a discrete sequence of multiple rl_digit_argument
+ commands (e.g, "M-1 M-2" instead of "M-1 2"). Report and fix from
+ Koichi Murase <myoga.murase@gmail.com>
+
+subst.c
+ - pat_subst: avoid calling RESIZE_MALLOCED_BUFFER with STRLEN(s) as an
+ argument, since it ends up going into a loop. Report and fix from
+ Koichi Murase <myoga.murase@gmail.com>
+
+lib/sh/casemod.c
+ - cval: take the string length as an argument, to avoid having to call
+ strlen every time (in HANDLE_MULTIBYTE mode). The caller already has
+ this info. Report and fix from Koichi Murase <myoga.murase@gmail.com>
+
+builtins/complete.def
+ - print_cmd_name: single-quote the command name if it contains any
+ shell metacharacters
+ - print_one_completion: call print_arg with a second arg of 1 if the
+ function name contains shell metacharacters. Report and fix from
+ Koichi Murase <myoga.murase@gmail.com>
+
+ 6/30
+ ----
+
+configure.ac
+ - substitute BASE_CFLAGS_FOR_BUILD and STYLE_CFLAGS into Makefile
+ targets
+ - take STYLE_CFLAGS out of the CFLAGS_FOR_BUILD variable that gets
+ substituted
+ - remove STYLE_CFLAGS from CFLAGS
+ - use `:+' expansion to set variables based on whether $GCC is set
+ or null, since configure can do GCC=
+
+support/Makefile.in
+ - man2html: remove CCFLAGS_FOR_BUILD from the recipe, leaving only
+ LDFLAGS_FOR_BUILD. Report from Jay K <jayk123@hotmail.com>
+ - gen-helpfiles: remove CCFLAGS_FOR_BUILD from the recipe, leaving
+ only LDFLAGS_FOR_BUILD
+ - man2html: use $(STYLE_CFLAGS) in BASE_CCFLAGS variable for C file
+ compilation options
+
+{,builtins}/Makefile.in, lib/{sh,readline,malloc,glob}/Makefile.in
+ - use STYLE_CFLAGS so specifying CFLAGS=-g to make doesn't clutter the
+ output with warnings about parens and format strings
diff --git a/Makefile.in b/Makefile.in
index 7df3f40..58f77bb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -137,6 +137,7 @@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ @CROSS_COMPILE@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG} ${MALLOC_DEBUG}
+STYLE_CFLAGS = @STYLE_CFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
@@ -152,7 +153,7 @@ LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
SYSTEM_FLAGS = -DPROGRAM='"$(Program)"' -DCONF_HOSTTYPE='"$(Machine)"' -DCONF_OSTYPE='"$(OS)"' -DCONF_MACHTYPE='"$(MACHTYPE)"' -DCONF_VENDOR='"$(VENDOR)"' $(LOCALE_DEFS)
BASE_CCFLAGS = $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
- $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES)
+ $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES) $(STYLE_CFLAGS)
CCFLAGS = $(ADDON_CFLAGS) $(BASE_CCFLAGS) ${PROFILE_FLAGS} $(CPPFLAGS) $(CFLAGS)
diff --git a/builtins/Makefile.in b/builtins/Makefile.in
index c0061ac..1f5add0 100644
--- a/builtins/Makefile.in
+++ b/builtins/Makefile.in
@@ -59,6 +59,7 @@ LIBBUILD = ${BUILD_DIR}/lib
PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ @CROSS_COMPILE@
+STYLE_CFLAGS = @STYLE_CFLAGS@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
@@ -92,7 +93,7 @@ HELPFILES_TARGET = @HELPFILES_TARGET@
INCLUDES = -I. -I.. @RL_INCLUDE@ -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
- ${INCLUDES} $(LOCAL_CFLAGS)
+ ${INCLUDES} $(STYLE_CFLAGS) $(LOCAL_CFLAGS)
CCFLAGS = ${ADDON_CFLAGS} $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
@@ -182,7 +183,7 @@ gen-helpfiles.o: gen-helpfiles.c
$(CC_FOR_BUILD) -c $(CCFLAGS_FOR_BUILD) $<
gen-helpfiles: tmpbuiltins.o gen-helpfiles.o
- $(CC_FOR_BUILD) ${CCFLAGS_FOR_BUILD} $(LDFLAGS_FOR_BUILD) -o $@ gen-helpfiles.o tmpbuiltins.o $(LIBS_FOR_BUILD)
+ $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ gen-helpfiles.o tmpbuiltins.o $(LIBS_FOR_BUILD)
builtext.h builtins.c: $(MKBUILTINS) $(DEFSRC)
@-if test -f builtins.c; then mv -f builtins.c old-builtins.c; fi
diff --git a/builtins/complete.def b/builtins/complete.def
index 28a9ec2..71572ee 100644
--- a/builtins/complete.def
+++ b/builtins/complete.def
@@ -541,6 +541,8 @@ static void
print_cmd_name (cmd)
const char *cmd;
{
+ char *x;
+
if (STREQ (cmd, DEFAULTCMD))
printf ("-D");
else if (STREQ (cmd, EMPTYCMD))
@@ -549,6 +551,12 @@ print_cmd_name (cmd)
printf ("-I");
else if (*cmd == 0) /* XXX - can this happen? */
printf ("''");
+ else if (sh_contains_shell_metas (cmd))
+ {
+ x = sh_single_quote (cmd);
+ printf ("%s", x);
+ free (x);
+ }
else
printf ("%s", cmd);
}
@@ -575,7 +583,7 @@ print_one_completion (cmd, cs)
print_arg (cs->command, "-C", 1);
/* simple arguments that don't require quoting */
- print_arg (cs->funcname, "-F", 0);
+ print_arg (cs->funcname, "-F", sh_contains_shell_metas (cs->funcname) != 0);
print_cmd_name (cmd);
printf ("\n");
diff --git a/configure b/configure
index 704b62e..9c99e7a 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac for Bash 5.1, version 5.023.
+# From configure.ac for Bash 5.1, version 5.025.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 5.1-maint.
#
@@ -735,6 +735,8 @@ RL_MINOR
RL_MAJOR
RL_VERSION
LIBS_FOR_BUILD
+STYLE_CFLAGS
+BASE_CFLAGS_FOR_BUILD
STATIC_LD
SIGNAMES_O
SIGNAMES_H
@@ -4229,9 +4231,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$want_auto_cflags"; then
- AUTO_CFLAGS="-g ${GCC+-O2}"
- AUTO_LDFLAGS="-g ${GCC+-O2}"
- STYLE_CFLAGS="${GCC+-Wno-parentheses} ${GCC+-Wno-format-security}"
+ AUTO_CFLAGS="-g ${GCC:+-O2}"
+ AUTO_LDFLAGS="-g ${GCC:+-O2}"
+ STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security}"
else
AUTO_CFLAGS= AUTO_LDFLAGS= STYLE_CFLAGS=
fi
@@ -5032,9 +5034,12 @@ if test "X$cross_compiling" = "Xno"; then
fi
# CFLAGS set above to default value if not passed in environment
if test -n "$want_auto_cflags" ; then
- CFLAGS_FOR_BUILD="${CFLAGS} ${STYLE_CFLAGS}"
+ CFLAGS_FOR_BUILD="${CFLAGS}"
+ BASE_CFLAGS_FOR_BUILD="${CFLAGS}"
else
+ # passed in environment
CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
+ BASE_CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
fi
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
else
@@ -5042,6 +5047,7 @@ else
CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD="-g"}
+ BASE_CFLAGS_FOR_BUILD=${BASE_CFLAGS_FOR_BUILD="-g"}
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-""}
fi
@@ -5056,6 +5062,8 @@ fi
+
+
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
$as_echo_n "checking whether $CC needs -traditional... " >&6; }
@@ -20487,7 +20495,7 @@ mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
esac
# turn off paren warnings in gcc
-CFLAGS="$CFLAGS ${STYLE_CFLAGS}"
+#CFLAGS="$CFLAGS ${STYLE_CFLAGS}"
#
# Shared object configuration section. These values are generated by
diff --git a/configure.ac b/configure.ac
index e47aed2..7bfc3fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 5.1, version 5.023])dnl
+AC_REVISION([for Bash 5.1, version 5.025])dnl
define(bashvers, 5.1)
define(relstatus, maint)
@@ -414,9 +414,9 @@ dnl different environment
AC_PROG_CC
if test -n "$want_auto_cflags"; then
- AUTO_CFLAGS="-g ${GCC+-O2}"
- AUTO_LDFLAGS="-g ${GCC+-O2}"
- STYLE_CFLAGS="${GCC+-Wno-parentheses} ${GCC+-Wno-format-security}"
+ AUTO_CFLAGS="-g ${GCC:+-O2}"
+ AUTO_LDFLAGS="-g ${GCC:+-O2}"
+ STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security}"
else
AUTO_CFLAGS= AUTO_LDFLAGS= STYLE_CFLAGS=
fi
@@ -516,9 +516,12 @@ if test "X$cross_compiling" = "Xno"; then
fi
# CFLAGS set above to default value if not passed in environment
if test -n "$want_auto_cflags" ; then
- CFLAGS_FOR_BUILD="${CFLAGS} ${STYLE_CFLAGS}"
+ CFLAGS_FOR_BUILD="${CFLAGS}"
+ BASE_CFLAGS_FOR_BUILD="${CFLAGS}"
else
+ # passed in environment
CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
+ BASE_CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
fi
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
else
@@ -526,6 +529,7 @@ else
CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD="-g"}
+ BASE_CFLAGS_FOR_BUILD=${BASE_CFLAGS_FOR_BUILD="-g"}
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-""}
fi
@@ -536,6 +540,8 @@ AC_SUBST(STATIC_LD)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
+AC_SUBST(BASE_CFLAGS_FOR_BUILD)
+AC_SUBST(STYLE_CFLAGS)
AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(LDFLAGS_FOR_BUILD)
AC_SUBST(LIBS_FOR_BUILD)
@@ -1208,7 +1214,7 @@ mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
esac
# turn off paren warnings in gcc
-CFLAGS="$CFLAGS ${STYLE_CFLAGS}"
+#CFLAGS="$CFLAGS ${STYLE_CFLAGS}"
#
# Shared object configuration section. These values are generated by
diff --git a/lib/glob/Makefile.in b/lib/glob/Makefile.in
index 314622f..27e34f9 100644
--- a/lib/glob/Makefile.in
+++ b/lib/glob/Makefile.in
@@ -42,6 +42,7 @@ PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
+STYLE_CFLAGS = @STYLE_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
@@ -53,7 +54,7 @@ BASHINCDIR = ${topdir}/include
INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib
CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) ${INCLUDES} $(CPPFLAGS) \
- $(LOCAL_CFLAGS) $(CFLAGS) ${ADDON_CFLAGS}
+ $(STYLE_CFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) ${ADDON_CFLAGS}
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
diff --git a/lib/malloc/Makefile.in b/lib/malloc/Makefile.in
index 0ef3cfd..5083188 100644
--- a/lib/malloc/Makefile.in
+++ b/lib/malloc/Makefile.in
@@ -38,6 +38,7 @@ PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
+STYLE_CFLAGS = @STYLE_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
@@ -56,7 +57,7 @@ LIBINTL_H = @LIBINTL_H@
INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib $(INTL_INC)
CCFLAGS = ${PROFILE_FLAGS} ${INCLUDES} $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) \
- $(CFLAGS) $(MALLOC_CFLAGS) $(CPPFLAGS)
+ $(CFLAGS) $(MALLOC_CFLAGS) $(STYLE_CFLAGS) $(CPPFLAGS)
.c.o:
$(CC) $(CCFLAGS) -c $<
diff --git a/lib/readline/Makefile.in b/lib/readline/Makefile.in
index b2358c6..3b16139 100644
--- a/lib/readline/Makefile.in
+++ b/lib/readline/Makefile.in
@@ -56,6 +56,7 @@ DEBUG = @DEBUG@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
+STYLE_CFLAGS = @STYLE_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
@@ -65,7 +66,7 @@ LOCAL_DEFS = @LOCAL_DEFS@
INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} \
- $(LOCAL_CFLAGS) $(CFLAGS) ${ADDON_CFLAGS}
+ $(STYLE_CFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) ${ADDON_CFLAGS}
.c.o:
${RM} $@
diff --git a/lib/readline/bind.c b/lib/readline/bind.c
index fdd61e9..f1456d6 100644
--- a/lib/readline/bind.c
+++ b/lib/readline/bind.c
@@ -888,25 +888,30 @@ rl_function_of_keyseq_len (const char *keyseq, size_t len, Keymap map, int *type
int
rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map)
{
- register int i, parsing_digits;
+ register int i, j, parsing_digits;
unsigned char ic;
+ Keymap map0;
if (map == 0)
map = _rl_keymap;
+ map0 = map;
/* The digits following the initial one (e.g., the binding to digit-argument)
or the optional `-' in a binding to digit-argument or universal-argument
are not added to rl_executing_keyseq. This is basically everything read by
rl_digit_loop. The parsing_digits logic is here in case they ever are. */
- for (i = parsing_digits = 0; keyseq && i < len; i++)
+ for (i = j = parsing_digits = 0; keyseq && i < len; i++)
{
ic = keyseq[i];
if (parsing_digits)
{
- if (_rl_digit_p (ic) == 0)
- return (i);
- continue;
+ if (_rl_digit_p (ic))
+ {
+ j = i + 1;
+ continue;
+ }
+ parsing_digits = 0;
}
if (map[ic].type == ISKMAP)
@@ -918,13 +923,18 @@ rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map)
}
if (map[ic].type == ISFUNC)
{
+#if defined (VI_MODE)
+ if (map[ic].function != rl_digit_argument && map[ic].function != rl_universal_argument && map[ic].function != rl_vi_arg_digit)
+#else
if (map[ic].function != rl_digit_argument && map[ic].function != rl_universal_argument)
- return -1;
+#endif
+ return (j);
/* We don't bother with a keyseq that is only a numeric argument */
if (i + 1 == len)
return -1;
+ map = map0;
parsing_digits = 1;
/* This logic should be identical to rl_digit_loop */
@@ -934,13 +944,12 @@ rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map)
{
i++;
parsing_digits = 2;
- continue;
}
if (map[ic].function == rl_digit_argument && ic == '-')
{
parsing_digits = 2;
- continue;
}
+ j = i + 1;
}
}
diff --git a/lib/sh/Makefile.in b/lib/sh/Makefile.in
index d68f0b8..cbaf94d 100644
--- a/lib/sh/Makefile.in
+++ b/lib/sh/Makefile.in
@@ -57,6 +57,7 @@ SHELL = @MAKE_SHELL@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
+STYLE_CFLAGS = @STYLE_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
@@ -68,7 +69,7 @@ LOCAL_DEFS = @LOCAL_DEFS@
INCLUDES = -I. -I../.. -I$(topdir) -I$(topdir)/lib -I$(BASHINCDIR) -I$(srcdir) $(INTL_INC)
CCFLAGS = ${ADDON_CFLAGS} ${PROFILE_FLAGS} ${INCLUDES} $(DEFS) $(LOCAL_DEFS) \
- $(LOCAL_CFLAGS) $(CFLAGS) $(CPPFLAGS)
+ $(LOCAL_CFLAGS) $(STYLE_CFLAGS) $(CFLAGS) $(CPPFLAGS)
GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
-Wcast-align -Wstrict-prototypes -Wconversion \
diff --git a/lib/sh/casemod.c b/lib/sh/casemod.c
index bdd96f8..0403f91 100644
--- a/lib/sh/casemod.c
+++ b/lib/sh/casemod.c
@@ -47,7 +47,7 @@
#define _to_wlower(wc) (iswupper (wc) ? towlower (wc) : (wc))
#if !defined (HANDLE_MULTIBYTE)
-# define cval(s, i) ((s)[(i)])
+# define cval(s, i, l) ((s)[(i)])
# define iswalnum(c) (isalnum(c))
# define TOGGLE(x) (ISUPPER (x) ? tolower ((unsigned char)x) : (TOUPPER (x)))
#else
@@ -75,18 +75,16 @@ extern char *substring PARAMS((char *, int, int));
#if defined (HANDLE_MULTIBYTE)
static wchar_t
-cval (s, i)
+cval (s, i, l)
char *s;
- int i;
+ int i, l;
{
size_t tmp;
wchar_t wc;
- int l;
mbstate_t mps;
if (MB_CUR_MAX == 1 || is_basic (s[i]))
return ((wchar_t)s[i]);
- l = strlen (s);
if (i >= (l - 1))
return ((wchar_t)s[i]);
memset (&mps, 0, sizeof (mbstate_t));
@@ -143,7 +141,7 @@ sh_modcase (string, pat, flags)
inword = 0;
while (start < end)
{
- wc = cval ((char *)string, start);
+ wc = cval ((char *)string, start, end);
if (iswalnum (wc) == 0)
inword = 0;
diff --git a/lib/tilde/Makefile.in b/lib/tilde/Makefile.in
index c21d389..4da9e2f 100644
--- a/lib/tilde/Makefile.in
+++ b/lib/tilde/Makefile.in
@@ -42,6 +42,7 @@ PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
+STYLE_CFLAGS = @STYLE_CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
@@ -53,7 +54,7 @@ BASHINCDIR = ${topdir}/include
INCLUDES = -I. -I../.. -I$(topdir) -I${BASHINCDIR} -I$(topdir)/lib
CCFLAGS = ${ASAN_CFLAGS} $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) \
- ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
+ ${INCLUDES} $(STYLE_CFLAGS) $(LOCAL_CFLAGS) $(CFLAGS)
.c.o:
$(CC) -c $(CCFLAGS) $<
diff --git a/parse.y b/parse.y
index dbb5cf1..6269089 100644
--- a/parse.y
+++ b/parse.y
@@ -2901,7 +2901,11 @@ yylex ()
}
if (current_token < 0)
+#if defined (YYERRCODE) && !defined (YYUNDEF)
+ current_token = YYERRCODE;
+#else
current_token = YYerror;
+#endif
return (current_token);
}
diff --git a/subst.c b/subst.c
index 427939a..7414846 100644
--- a/subst.c
+++ b/subst.c
@@ -8454,7 +8454,8 @@ pat_subst (string, pat, rep, mflags)
/* Now copy the unmatched portion of the input string */
if (str && *str)
{
- RESIZE_MALLOCED_BUFFER (ret, rptr, STRLEN(str) + 1, rsize, 64);
+ l = send - str + 1;
+ RESIZE_MALLOCED_BUFFER (ret, rptr, l, rsize, 64);
strcpy (ret + rptr, str);
}
else
diff --git a/support/Makefile.in b/support/Makefile.in
index f0a1784..44bf8f0 100644
--- a/support/Makefile.in
+++ b/support/Makefile.in
@@ -46,9 +46,11 @@ PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+BASE_CFLAGS_FOR_BUILD = @BASE_CFLAGS_FOR_BUILD@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
+STYLE_CFLAGS = @STYLE_CFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
@@ -56,13 +58,13 @@ LIBS = @LIBS@
LIBS_FOR_BUILD = ${LIBS} # XXX
LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
-LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
+LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS)
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
INCLUDES = -I${BUILD_DIR} -I${topdir}
BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
- ${INCLUDES} $(LOCAL_CFLAGS)
+ ${INCLUDES} $(STYLE_CFLAGS) $(LOCAL_CFLAGS)
CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
@@ -77,7 +79,7 @@ OBJ1 = man2html.o
all: man2html$(EXEEXT)
man2html$(EXEEXT): $(OBJ1)
- $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(OBJ1) -o $@ ${LIBS_FOR_BUILD}
+ $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(OBJ1) -o $@ ${LIBS_FOR_BUILD}
clean:
$(RM) man2html$(EXEEXT) $(OBJ1)
diff --git a/tests/extglob7.sub b/tests/extglob7.sub
index 16be005..07a6071 100644
--- a/tests/extglob7.sub
+++ b/tests/extglob7.sub
@@ -10,7 +10,7 @@ cd $TESTDIR || {
exit 1
}
-
+LC_CTYPE=C LC_COLLATE=C
shopt -s extglob dotglob
touch .foo bar .a