gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-5073-g6a47b1de


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-5073-g6a47b1de
Date: Sun, 9 Jul 2023 14:45:49 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-5.2-stable has been updated
       via  6a47b1de54cbc22a0204525ce81e0c093118737b (commit)
      from  6c3312032f5ea988431efd2b78ef39519a95c4c3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=6a47b1de54cbc22a0204525ce81e0c093118737b

commit 6a47b1de54cbc22a0204525ce81e0c093118737b
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sun Jul 9 21:45:18 2023 +0300

    Bug fix in bad regexp error message + new test for it.

diff --git a/ChangeLog b/ChangeLog
index 2670cff8..15a32135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-09         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * re.c (make_regexp): In error message, use the original text
+       directly as a string and not with calculated length. Thanks
+       to Neil R. Ormos <ormos-gnulists17@ormos.org> for the report.
+
 2023-06-27         Arnold D. Robbins     <arnold@skeeve.com>
 
        * NEWS: Updated.
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 5ac40026..6f5620f3 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2023-07-09         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2023-06-12         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 23380115..c21c5fe1 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -171,7 +171,8 @@ BASIC_TESTS = \
        paramuninitglobal parse1 parsefld parseme pcntplus posix2008sub \
        posix_compare prdupval prec printf0 printf1 printfchar prmarscl \
        prmreuse prt1eval prtoeval rand randtest range1 range2 readbuf \
-       rebrackloc rebt8b1 rebuild redfilnm regeq regex3minus regexpbrack \
+       rebrackloc rebt8b1 rebuild redfilnm regeq regex3minus \
+       regexpbad regexpbrack \
        regexpbrack2 regexprange regrange reindops reparse resplit \
        rri1 rs rscompat rsnul1nl rsnulbig rsnulbig2 rsnullre rsnulw \
        rstest1 rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin \
@@ -2252,6 +2253,11 @@ regex3minus:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+regexpbad:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 regexpbrack:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/re.c b/re.c
index 9c1905a6..3860d88c 100644
--- a/re.c
+++ b/re.c
@@ -53,6 +53,8 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool 
dfa, bool canfatal)
        static struct dfa* dfaregs[2] = { NULL, NULL };
        static bool nul_warned = false;
 
+       assert(s[len] == '\0');
+
        if (do_lint && ! nul_warned && memchr(s, '\0', len) != NULL) {
                nul_warned = true;
                lintwarn(_("behavior of matching a regexp containing NUL 
characters is not defined by POSIX"));
@@ -258,10 +260,10 @@ make_regexp(const char *s, size_t len, bool ignorecase, 
bool dfa, bool canfatal)
                refree(rp);
                if (! canfatal) {
                        /* rerr already gettextized inside regex routines */
-                       error("%s: /%.*s/", rerr, (int) len, s);
+                       error("%s: /%s/", rerr, s);
                        return NULL;
                }
-               fatal("invalid regexp: %s: /%.*s/", rerr, (int) len, s);
+               fatal("invalid regexp: %s: /%s/", rerr, s);
        }
 
        /* gack. this must be done *after* re_compile_pattern */
diff --git a/test/ChangeLog b/test/ChangeLog
index 9a5b0236..9608f5de 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2023-07-09         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.am (EXTRA_DIST): New test, regexpbad.
+       * regexpbad.sh, regexpbad.ok: New files.
+
 2023-06-12         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.am (EXTRA_DIST): New test, cmdlinefsbacknl.
diff --git a/test/Makefile.am b/test/Makefile.am
index 154c0acb..36b302eb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1123,6 +1123,8 @@ EXTRA_DIST = \
        regeq.ok \
        regex3minus.awk \
        regex3minus.ok \
+       regexpbad.awk \
+       regexpbad.ok \
        regexpbrack.awk \
        regexpbrack.in \
        regexpbrack.ok \
@@ -1491,7 +1493,8 @@ BASIC_TESTS = \
        paramuninitglobal parse1 parsefld parseme pcntplus posix2008sub \
        posix_compare prdupval prec printf0 printf1 printfchar prmarscl \
        prmreuse prt1eval prtoeval rand randtest range1 range2 readbuf \
-       rebrackloc rebt8b1 rebuild redfilnm regeq regex3minus regexpbrack \
+       rebrackloc rebt8b1 rebuild redfilnm regeq regex3minus \
+       regexpbad regexpbrack \
        regexpbrack2 regexprange regrange reindops reparse resplit \
        rri1 rs rscompat rsnul1nl rsnulbig rsnulbig2 rsnullre rsnulw \
        rstest1 rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin \
diff --git a/test/Makefile.in b/test/Makefile.in
index 751979d9..a5981131 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1391,6 +1391,8 @@ EXTRA_DIST = \
        regeq.ok \
        regex3minus.awk \
        regex3minus.ok \
+       regexpbad.awk \
+       regexpbad.ok \
        regexpbrack.awk \
        regexpbrack.in \
        regexpbrack.ok \
@@ -1759,7 +1761,8 @@ BASIC_TESTS = \
        paramuninitglobal parse1 parsefld parseme pcntplus posix2008sub \
        posix_compare prdupval prec printf0 printf1 printfchar prmarscl \
        prmreuse prt1eval prtoeval rand randtest range1 range2 readbuf \
-       rebrackloc rebt8b1 rebuild redfilnm regeq regex3minus regexpbrack \
+       rebrackloc rebt8b1 rebuild redfilnm regeq regex3minus \
+       regexpbad regexpbrack \
        regexpbrack2 regexprange regrange reindops reparse resplit \
        rri1 rs rscompat rsnul1nl rsnulbig rsnulbig2 rsnullre rsnulw \
        rstest1 rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin \
@@ -4028,6 +4031,11 @@ regex3minus:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+regexpbad:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 regexpbrack:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 2b7c7130..f3d4c494 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -944,6 +944,11 @@ regex3minus:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+regexpbad:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 regexpbrack:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/regexpbad.awk b/test/regexpbad.awk
new file mode 100644
index 00000000..a880e43b
--- /dev/null
+++ b/test/regexpbad.awk
@@ -0,0 +1 @@
+BEGIN { print match("a[", /^[^[]\x5b/) }
diff --git a/test/regexpbad.ok b/test/regexpbad.ok
new file mode 100644
index 00000000..f9b90b2f
--- /dev/null
+++ b/test/regexpbad.ok
@@ -0,0 +1,2 @@
+gawk: regexpbad.awk:1: error: Invalid regular expression: /^[^[]\x5b/
+EXIT CODE: 1

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |  6 ++++++
 pc/ChangeLog       |  4 ++++
 pc/Makefile.tst    |  8 +++++++-
 re.c               |  6 ++++--
 test/ChangeLog     |  5 +++++
 test/Makefile.am   |  5 ++++-
 test/Makefile.in   | 10 +++++++++-
 test/Maketests     |  5 +++++
 test/regexpbad.awk |  1 +
 test/regexpbad.ok  |  2 ++
 10 files changed, 47 insertions(+), 5 deletions(-)
 create mode 100644 test/regexpbad.awk
 create mode 100644 test/regexpbad.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]