summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-12 21:53:29 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-12 21:53:29 -0500
commit108a433ea81fb9a4717d4c94f17560ebf685af8b (patch)
tree37b3f71e851a0df5683ce56b6295fb3f80a4e1a5
parent68dfe178e929a589393f63a3778d4e5d337c1e32 (diff)
downloadbash-108a433ea81fb9a4717d4c94f17560ebf685af8b.tar.gz
commit bash-20100129 snapshot
-rw-r--r--CWRU/CWRU.chlog9
-rw-r--r--CWRU/CWRU.chlog~2
-rw-r--r--MANIFEST1
-rw-r--r--Makefile.in2
-rw-r--r--autom4te.cache/requests22
-rw-r--r--bashline.c2
-rw-r--r--bashline.c~9
-rw-r--r--parse.y8
-rwxr-xr-xtests/RUN-ONE-TEST2
-rw-r--r--tests/arith.right17
-rw-r--r--tests/arith.tests1
-rw-r--r--tests/arith3.sub45
12 files changed, 101 insertions, 19 deletions
diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog
index f015b4dd..fefe32d1 100644
--- a/CWRU/CWRU.chlog
+++ b/CWRU/CWRU.chlog
@@ -9457,3 +9457,12 @@ arrayfunc.c
invisible. Pointed out by Mart Frauenlab <mart.frauenlob@chello.at>
- change array_value_internal to return NULL for variable which has
not been set
+
+ 1/30
+ ----
+bashline.c
+ - in command_word_completion_function, don't call glob_pattern_p
+ on hint -- use the already-computed `globpat'. At this point,
+ hint might contain an already-dequoted globbing character, but
+ glob_matches will be NULL. Fixes bug reported by
+ coyote@wariat.org.pl
diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~
index 6230712d..f015b4dd 100644
--- a/CWRU/CWRU.chlog~
+++ b/CWRU/CWRU.chlog~
@@ -9455,3 +9455,5 @@ builtins/setattr.def
arrayfunc.c
- fix array_keys to return NULL if the variable is not set or
invisible. Pointed out by Mart Frauenlab <mart.frauenlob@chello.at>
+ - change array_value_internal to return NULL for variable which has
+ not been set
diff --git a/MANIFEST b/MANIFEST
index 6b9e9f29..ffc26fae 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -743,6 +743,7 @@ tests/arith.tests f
tests/arith.right f
tests/arith1.sub f
tests/arith2.sub f
+tests/arith3.sub f
tests/array.tests f
tests/array.right f
tests/array1.sub f
diff --git a/Makefile.in b/Makefile.in
index f01d49c7..dbdc27d2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1184,7 +1184,7 @@ jobs.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
mailcheck.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
make_cmd.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
nojobs.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
-parse.y: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
+y.tab.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
pcomplete.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
pcomplib.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
print_cmd.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
diff --git a/autom4te.cache/requests b/autom4te.cache/requests
index 4a5e08c9..014c1526 100644
--- a/autom4te.cache/requests
+++ b/autom4te.cache/requests
@@ -15,25 +15,25 @@
'configure.in'
],
{
- '_LT_AC_TAGCONFIG' => 1,
'AM_PROG_F77_C_O' => 1,
- 'AC_INIT' => 1,
+ '_LT_AC_TAGCONFIG' => 1,
'm4_pattern_forbid' => 1,
- '_AM_COND_IF' => 1,
+ 'AC_INIT' => 1,
'AC_CANONICAL_TARGET' => 1,
- 'AC_SUBST' => 1,
+ '_AM_COND_IF' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
- 'AC_FC_SRCEXT' => 1,
+ 'AC_SUBST' => 1,
'AC_CANONICAL_HOST' => 1,
+ 'AC_FC_SRCEXT' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
- 'AC_REQUIRE_AUX_FILE' => 1,
'AC_CONFIG_LINKS' => 1,
- 'm4_sinclude' => 1,
+ 'AC_REQUIRE_AUX_FILE' => 1,
'LT_SUPPORTED_TAG' => 1,
+ 'm4_sinclude' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'_m4_warn' => 1,
@@ -49,13 +49,13 @@
'AC_CANONICAL_BUILD' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
- '_AM_SUBST_NOTMAKE' => 1,
'AC_CONFIG_AUX_DIR' => 1,
- 'sinclude' => 1,
- 'm4_pattern_allow' => 1,
+ '_AM_SUBST_NOTMAKE' => 1,
'AM_PROG_CC_C_O' => 1,
- 'AC_CANONICAL_SYSTEM' => 1,
+ 'm4_pattern_allow' => 1,
+ 'sinclude' => 1,
'AM_CONDITIONAL' => 1,
+ 'AC_CANONICAL_SYSTEM' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'm4_include' => 1,
diff --git a/bashline.c b/bashline.c
index 345c5755..6164bc6f 100644
--- a/bashline.c
+++ b/bashline.c
@@ -1680,7 +1680,7 @@ globword:
a single match (multiple matches that end up reducing the number of
characters in the common prefix are bad) will ever be returned on
regular completion. */
- if (glob_pattern_p (hint))
+ if (globpat)
{
if (state == 0)
{
diff --git a/bashline.c~ b/bashline.c~
index 4d0a1cbf..3654cee8 100644
--- a/bashline.c~
+++ b/bashline.c~
@@ -1680,7 +1680,11 @@ globword:
a single match (multiple matches that end up reducing the number of
characters in the common prefix are bad) will ever be returned on
regular completion. */
+#if 1
+ if (globpat)
+#else
if (glob_pattern_p (hint))
+#endif
{
if (state == 0)
{
@@ -3421,7 +3425,10 @@ static int
putx(c)
int c;
{
- return (putc (c, rl_outstream));
+ int x;
+
+ x = putc (c, rl_outstream);
+ return (x);
}
static int
diff --git a/parse.y b/parse.y
index f8f00c47..3edf7cce 100644
--- a/parse.y
+++ b/parse.y
@@ -3340,6 +3340,14 @@ parse_comsub (qc, open, close, lenp, flags)
char *ret, *nestret, *ttrans, *heredelim;
int retind, retsize, rflags, hdlen;
+#if 0 /* XXX - bash-4.2 -- jwm@horde.net */
+ /* Assume $(( introduces arithmetic command and parse accordingly. */
+ peekc = shell_getc (0);
+ shell_ungetc (peekc);
+ if (peekc == '(')
+ return (parse_matched_pair (qc, open, close, lenp, 0));
+#endif
+
/*itrace("parse_comsub: qc = `%c' open = %c close = %c", qc, open, close);*/
count = 1;
tflags = LEX_RESWDOK;
diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST
index 72ec06a2..3efcf32d 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
diff --git a/tests/arith.right b/tests/arith.right
index 51d740e4..41e2654b 100644
--- a/tests/arith.right
+++ b/tests/arith.right
@@ -191,14 +191,23 @@ ok
-7
7
7
+1
+1
+4
+5
+-3
+2
+4
+10000
+10000
8 12
-./arith.tests: line 274: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
-./arith.tests: line 278: a b: syntax error in expression (error token is "b")
-./arith.tests: line 279: ((: a b: syntax error in expression (error token is "b")
+./arith.tests: line 275: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
+./arith.tests: line 279: a b: syntax error in expression (error token is "b")
+./arith.tests: line 280: ((: a b: syntax error in expression (error token is "b")
42
42
42
42
42
42
-./arith.tests: line 290: b[c]d: syntax error in expression (error token is "d")
+./arith.tests: line 291: b[c]d: syntax error in expression (error token is "d")
diff --git a/tests/arith.tests b/tests/arith.tests
index 9e82bb1d..21bfdca4 100644
--- a/tests/arith.tests
+++ b/tests/arith.tests
@@ -262,6 +262,7 @@ echo $(( --7 ))
${THIS_SH} ./arith1.sub
${THIS_SH} ./arith2.sub
+${THIS_SH} ./arith3.sub
x=4
y=7
diff --git a/tests/arith3.sub b/tests/arith3.sub
new file mode 100644
index 00000000..e8464474
--- /dev/null
+++ b/tests/arith3.sub
@@ -0,0 +1,45 @@
+RANDOM=42
+(( dice[RANDOM%6+1 + RANDOM%6+1]++ ))
+echo ${dice[5]}
+
+(( ++dice[RANDOM%6+1 + RANDOM%6+1] ))
+echo ${dice[6]}
+
+v=4
+DIND=20
+
+(( dice[DIND%6 + 1]=v ))
+echo ${dice[3]}
+
+RANDOM=42
+
+(( dice[RANDOM%6+1 + RANDOM%6+1]+=v ))
+echo ${dice[5]}
+
+(( dice[RANDOM%6+1 + RANDOM%6+1]-=v ))
+echo ${dice[6]}
+
+(( dice[RANDOM%6+1 + RANDOM%6+1]+=2 ))
+echo ${dice[11]}
+
+(( dice[RANDOM%6+1 + RANDOM%6+1]*=2 ))
+echo ${dice[11]}
+
+unset dice1 dice2
+RANDOM=42
+
+for i in {1..10000}; do ((dice1[$RANDOM%6+1 + $RANDOM%6+1]++)); done;
+unset t; for i in ${dice1[@]}; do ((t+=i)); done; echo $t
+
+foo="${dice1[@]}"
+
+RANDOM=42
+
+for i in {1..10000}; do ((dice2[RANDOM%6+1 + RANDOM%6+1]++)); done;
+unset t; for i in ${dice2[@]}; do ((t+=i)); done; echo $t
+
+bar="${dice2[@]}"
+
+if [ "$foo" != "$bar" ]; then
+ echo "random sequences differ"
+fi