aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--awkgram.c9
-rw-r--r--awkgram.y9
-rw-r--r--re.c11
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rwxr-xr-xtest/negrange.awk7
-rw-r--r--test/negrange.ok7
10 files changed, 70 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3911ba8f..a57fb97a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Mon Feb 7 11:23:33 2011 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (next_sourcefile): Comment out assertion that
+ lexeof is true; causes core dump on user typos of bad
+ characters which previous versions did not do. Thanks to
+ Pat Rankin for the report.
+
+ * re.c (expand_range): Allow for ^ as first character
+ inside range. Thanks for Nelson Beebe for the bug report.
+
Fri Feb 4 10:28:19 2011 Arnold D. Robbins <arnold@skeeve.com>
* README.cvs: Udpated.
diff --git a/awkgram.c b/awkgram.c
index 6a283d53..16733a59 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4973,7 +4973,14 @@ next_sourcefile()
closefunc = one_line_close;
}
- assert(lexeof == TRUE);
+ /*
+ * This won't be true if there's an invalid character in
+ * the source file or source string (e.g., user typo).
+ * Previous versions of gawk did not core dump in such a
+ * case.
+ *
+ * assert(lexeof == TRUE);
+ */
lexeof = FALSE;
eof_warned = FALSE;
sourcefile->srclines = sourceline; /* total no of lines in current file */
diff --git a/awkgram.y b/awkgram.y
index 3de7c511..01d0ebf8 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -2326,7 +2326,14 @@ next_sourcefile()
closefunc = one_line_close;
}
- assert(lexeof == TRUE);
+ /*
+ * This won't be true if there's an invalid character in
+ * the source file or source string (e.g., user typo).
+ * Previous versions of gawk did not core dump in such a
+ * case.
+ *
+ * assert(lexeof == TRUE);
+ */
lexeof = FALSE;
eof_warned = FALSE;
sourcefile->srclines = sourceline; /* total no of lines in current file */
diff --git a/re.c b/re.c
index 091a7774..b386aa68 100644
--- a/re.c
+++ b/re.c
@@ -525,7 +525,7 @@ void
dfawarn(const char *dfa_warning)
{
/*
- * This routine does nothing, since gawk does it's own
+ * This routine does nothing, since gawk does its own
* (better) check for bad [[:foo:]] syntax.
*/
}
@@ -680,7 +680,14 @@ again:
goto done;
copy(); /* copy in the [ */
- if (*sp == '-') /* it's literal, just copy it and skip over */
+ if (*sp == '^') /* allow for negation of range */
+ copy();
+
+ /*
+ * Minus as first character after [ or ^ is literal,
+ * just copy it and skip over.
+ */
+ if (*sp == '-')
copy();
while (count > 0 && len > 0) {
diff --git a/test/ChangeLog b/test/ChangeLog
index 0f380b08..e1b9f908 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+Mon Feb 7 21:39:39 2011 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (negrange): New test.
+ * negrange.awk, negrange.ok: New files.
+
Tue Feb 1 23:21:39 2011 Arnold D. Robbins <arnold@skeeve.com>
* xref.awk: Change sort command to just "sort"; avoids
diff --git a/test/Makefile.am b/test/Makefile.am
index 27876090..fb84ca13 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -407,6 +407,8 @@ EXTRA_DIST = \
nasty2.ok \
negexp.awk \
negexp.ok \
+ negrange.awk \
+ negrange.ok \
nested.awk \
nested.in \
nested.ok \
@@ -736,7 +738,7 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayprm2 arrayprm3 \
getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest gsubtst2 \
gsubtst3 gsubtst4 gsubtst5 gsubtst6 hex hsprint inputred intest intprec iobug1 \
leaddig leadnl litoct longsub longwrds manglprm math membug1 messages \
- minusstr mmap8k mtchi18n nasty nasty2 negexp nested nfldstr nfneg \
+ minusstr mmap8k mtchi18n nasty nasty2 negexp negrange nested nfldstr nfneg \
nfset nlfldsep nlinstr nlstrina noeffect nofile nofmtch noloop1 \
noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \
ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramres \
diff --git a/test/Makefile.in b/test/Makefile.in
index d035ef22..d1ade6ca 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -592,6 +592,8 @@ EXTRA_DIST = \
nasty2.ok \
negexp.awk \
negexp.ok \
+ negrange.awk \
+ negrange.ok \
nested.awk \
nested.in \
nested.ok \
@@ -921,7 +923,7 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayprm2 arrayprm3 \
getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest gsubtst2 \
gsubtst3 gsubtst4 gsubtst5 gsubtst6 hex hsprint inputred intest intprec iobug1 \
leaddig leadnl litoct longsub longwrds manglprm math membug1 messages \
- minusstr mmap8k mtchi18n nasty nasty2 negexp nested nfldstr nfneg \
+ minusstr mmap8k mtchi18n nasty nasty2 negexp negrange nested nfldstr nfneg \
nfset nlfldsep nlinstr nlstrina noeffect nofile nofmtch noloop1 \
noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \
ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramres \
@@ -2089,6 +2091,11 @@ negexp:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+negrange:
+ @echo negrange
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
nested:
@echo nested
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index c0222139..4872a504 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -420,6 +420,11 @@ negexp:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+negrange:
+ @echo negrange
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
nested:
@echo nested
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/negrange.awk b/test/negrange.awk
new file mode 100755
index 00000000..d70f7308
--- /dev/null
+++ b/test/negrange.awk
@@ -0,0 +1,7 @@
+BEGIN {
+ s = "Volume 8, Numbers 1-2 / January 1971"
+ n = split(s, parts, "[^-A-Za-z0-9]+")
+ print "n =", n
+ for (i = 1; i <= n; i++)
+ printf("s[%d] = \"%s\"\n", i, parts[i])
+}
diff --git a/test/negrange.ok b/test/negrange.ok
new file mode 100644
index 00000000..57f4c8e2
--- /dev/null
+++ b/test/negrange.ok
@@ -0,0 +1,7 @@
+n = 6
+s[1] = "Volume"
+s[2] = "8"
+s[3] = "Numbers"
+s[4] = "1-2"
+s[5] = "January"
+s[6] = "1971"