gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-305


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-3051-g5e4861a
Date: Fri, 21 Sep 2018 06:16:09 -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-4.2-stable has been updated
       via  5e4861ab4c41b6e000dc1f66225486330b5e5a2d (commit)
      from  f6a89a9b3ecd956e97b61719ea0d634886ace814 (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=5e4861ab4c41b6e000dc1f66225486330b5e5a2d

commit 5e4861ab4c41b6e000dc1f66225486330b5e5a2d
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Sep 21 13:15:38 2018 +0300

    Bug fix for trailing backslash in dynamic regexp.

diff --git a/ChangeLog b/ChangeLog
index 02c12bf..04b8528 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2018-09-21         Arnold D. Robbins     <address@hidden>
 
+       * re.c (make_regexp): Handle backslash at end of
+       input string. Thanks to Anatoly Trosinenko
+       <address@hidden> for the report.
+       Also, improve the error message when compilation of
+       the regexp fails.
+
+2018-09-21         Arnold D. Robbins     <address@hidden>
+
        * io.c (fork_and_open_slave_pty): Move an errant close brace
        inside the #endif so that gawk will compile on AIX. Thanks to
        Fredrik Laurin <address@hidden> for the report.
diff --git a/re.c b/re.c
index eefdfcd..a693a9a 100644
--- a/re.c
+++ b/re.c
@@ -112,6 +112,12 @@ make_regexp(const char *s, size_t len, bool ignorecase, 
bool dfa, bool canfatal)
                    (*src == '\\')) {
                        c = *++src;
                        switch (c) {
+                       case '\0':      /* \\ before \0, either dynamic data or 
real end of string */
+                               if (src >= s + len)
+                                       *dest++ = '\\'; // at end of string, 
will fatal below
+                               else
+                                       fatal(_("invalid NUL byte in dynamic 
regexp"));
+                               break;
                        case 'a':
                        case 'b':
                        case 'f':
@@ -241,7 +247,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, 
bool dfa, bool canfatal)
                        error("%s: /%s/", rerr, buf);
                        return NULL;
                }
-               fatal("%s: /%s/", rerr, buf);
+               fatal("invalid regexp: %s: /%s/", rerr, buf);
        }
 
        /* gack. this must be done *after* re_compile_pattern */
diff --git a/test/ChangeLog b/test/ChangeLog
index adc93ae..4eb36e0 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-21         Arnold D. Robbins     <address@hidden>
+
+       * Maefile.am (EXTRA_DIST): New test: trailbs.
+       * trailbs.awk, trailbs.in, trailbs.ok: New files.
+
 2018-09-16         Arnold D. Robbins     <address@hidden>
 
        * Makefile.in: Regenerated, using Automake 1.16.1.
diff --git a/test/Makefile.am b/test/Makefile.am
index 74f82aa..3eca3e9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1161,6 +1161,9 @@ EXTRA_DIST = \
        tradanch.awk \
        tradanch.in \
        tradanch.ok \
+       trailbs.awk \
+       trailbs.in \
+       trailbs.ok \
        tweakfld.awk \
        tweakfld.in \
        tweakfld.ok \
@@ -1270,7 +1273,7 @@ BASIC_TESTS = \
        sigpipe1 sortempty sortglos spacere splitargv splitarr \
        splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \
        subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 
\
-       tailrecurse tradanch tweakfld \
+       tailrecurse tradanch trailbs tweakfld \
        uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \
        wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \
        zero2 zeroe0 zeroflag
diff --git a/test/Makefile.in b/test/Makefile.in
index 34ec85b..3a6f564 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1419,6 +1419,9 @@ EXTRA_DIST = \
        tradanch.awk \
        tradanch.in \
        tradanch.ok \
+       trailbs.awk \
+       trailbs.in \
+       trailbs.ok \
        tweakfld.awk \
        tweakfld.in \
        tweakfld.ok \
@@ -1528,7 +1531,7 @@ BASIC_TESTS = \
        sigpipe1 sortempty sortglos spacere splitargv splitarr \
        splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \
        subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 
\
-       tailrecurse tradanch tweakfld \
+       tailrecurse tradanch trailbs tweakfld \
        uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \
        wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \
        zero2 zeroe0 zeroflag
@@ -3767,6 +3770,11 @@ tradanch:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  --traditional < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+trailbs:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 uninit2:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  --lint >_$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index eb7c465..e24fed8 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1113,6 +1113,11 @@ tradanch:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  --traditional < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+trailbs:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 uninit2:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  --lint >_$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
diff --git a/test/trailbs.awk b/test/trailbs.awk
new file mode 100644
index 0000000..9b8c6d6
--- /dev/null
+++ b/test/trailbs.awk
@@ -0,0 +1 @@
+0~$0
\ No newline at end of file
diff --git a/test/trailbs.in b/test/trailbs.in
new file mode 100644
index 0000000..4434fe2
--- /dev/null
+++ b/test/trailbs.in
@@ -0,0 +1 @@
+00000ía000000000000000\
\ No newline at end of file
diff --git a/test/trailbs.ok b/test/trailbs.ok
new file mode 100644
index 0000000..b0bb8d3
--- /dev/null
+++ b/test/trailbs.ok
@@ -0,0 +1,2 @@
+gawk: trailbs.awk:1: (FILENAME=- FNR=1) fatal: invalid regexp: Trailing 
backslash: /00000ía000000000000000\/
+EXIT CODE: 2

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

Summary of changes:
 ChangeLog        |  8 ++++++++
 re.c             |  8 +++++++-
 test/ChangeLog   |  5 +++++
 test/Makefile.am |  5 ++++-
 test/Makefile.in | 10 +++++++++-
 test/Maketests   |  5 +++++
 test/trailbs.awk |  1 +
 test/trailbs.in  |  1 +
 test/trailbs.ok  |  2 ++
 9 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 test/trailbs.awk
 create mode 100644 test/trailbs.in
 create mode 100644 test/trailbs.ok


hooks/post-receive
-- 
gawk



reply via email to

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