gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5426-g8add693f


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5426-g8add693f
Date: Thu, 16 Nov 2023 11:09:17 -0500 (EST)

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.3-stable has been updated
       via  8add693f0ebd1096241b2e96e3f50196f00133d5 (commit)
      from  289577a98a5184443ffa72527d6c6fdf93cd9f07 (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=8add693f0ebd1096241b2e96e3f50196f00133d5

commit 8add693f0ebd1096241b2e96e3f50196f00133d5
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Nov 16 18:08:55 2023 +0200

    Fix string/regex comparisons.

diff --git a/ChangeLog b/ChangeLog
index 739327d1..324e12c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-11-16         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * eval.c (cmp_scalars): Check for REGEX as well as STRING
+       in order to do a string compare. Thanks to
+       "*" <cl2ap0101@gmail.com> for the report.
+
 2023-11-04         Arnold D. Robbins     <arnold@skeeve.com>
 
        * NEWS: Fix the spelling of "Ukrainian". Thanks to
diff --git a/eval.c b/eval.c
index 6bc39deb..0fd6859f 100644
--- a/eval.c
+++ b/eval.c
@@ -1558,7 +1558,7 @@ cmp_scalars(scalar_cmp_t comparison_type)
                fatal(_("attempt to use array `%s' in a scalar context"), 
array_vname(t1));
        }
 
-       if ((t1->flags & STRING) != 0 || (t2->flags & STRING) != 0) {
+       if ((t1->flags & (STRING|REGEX)) != 0 || (t2->flags & (STRING|REGEX)) 
!= 0) {
                bool use_strcmp = (comparison_type == SCALAR_EQ || 
comparison_type == SCALAR_NEQ);
                di = cmp_nodes(t1, t2, use_strcmp);
 
diff --git a/pc/ChangeLog b/pc/ChangeLog
index cfd16179..0a42ff96 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2023-11-16         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2023-11-02         Arnold D. Robbins     <arnold@skeeve.com>
 
        * 5.3.0: Release tar ball made.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 0eea359e..39fe220a 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -221,7 +221,8 @@ GAWK_EXT_TESTS = \
        symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
        symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
        typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
-       typeof4 typeof5 typeof6 unicode1 watchpoint1
+       typeof4 typeof5 typeof6 unicode1 watchpoint1 \
+       re_test
 
 ARRAYDEBUG_TESTS = arrdbg
 EXTRA_TESTS = inftest regtest ignrcas3 
@@ -3632,6 +3633,11 @@ unicode1:
        AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? 
>>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+re_test:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 double1:
        @echo $@ $(ZOS_FAIL)
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index adb5b536..7d7e96b9 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2023-11-16         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.am (EXTRA_DIST): New test, re_test.
+       * re_test.awk, re_test.in, re_test.ok: New files.
+
 2023-11-02         Arnold D. Robbins     <arnold@skeeve.com>
 
        * 5.3.0: Release tar ball made.
diff --git a/test/Makefile.am b/test/Makefile.am
index 89d0d8fd..6991272c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1187,6 +1187,8 @@ EXTRA_DIST = \
        revout.ok \
        revtwoway.awk \
        revtwoway.ok \
+       re_test.awk \
+       re_test.ok \
        rri1.awk \
        rri1.in \
        rri1.ok \
@@ -1567,7 +1569,8 @@ GAWK_EXT_TESTS = \
        symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
        symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
        typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
-       typeof4 typeof5 typeof6 unicode1 watchpoint1
+       typeof4 typeof5 typeof6 unicode1 watchpoint1 \
+       re_test
 
 ARRAYDEBUG_TESTS = arrdbg
 
diff --git a/test/Makefile.in b/test/Makefile.in
index 1ac601e4..c437d114 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1451,6 +1451,8 @@ EXTRA_DIST = \
        revout.ok \
        revtwoway.awk \
        revtwoway.ok \
+       re_test.awk \
+       re_test.ok \
        rri1.awk \
        rri1.in \
        rri1.ok \
@@ -1831,7 +1833,8 @@ GAWK_EXT_TESTS = \
        symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
        symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
        typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
-       typeof4 typeof5 typeof6 unicode1 watchpoint1
+       typeof4 typeof5 typeof6 unicode1 watchpoint1 \
+       re_test
 
 ARRAYDEBUG_TESTS = arrdbg
 EXTRA_TESTS = inftest regtest ignrcas3 
@@ -5419,6 +5422,11 @@ unicode1:
        AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? 
>>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+re_test:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 double1:
        @echo $@ $(ZOS_FAIL)
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 457a9c0f..baaef547 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -2314,6 +2314,11 @@ unicode1:
        AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? 
>>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+re_test:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 double1:
        @echo $@ $(ZOS_FAIL)
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
diff --git a/test/re_test.awk b/test/re_test.awk
new file mode 100644
index 00000000..63679649
--- /dev/null
+++ b/test/re_test.awk
@@ -0,0 +1,16 @@
+BEGIN {
+       x = @/bar/
+       y[0] = @/bar/
+       y[1] = @/baz/
+       y[2] = "bar"
+       y[3] = "baz"
+       printf("* set: x = @/%s/\n", x)
+       for (i in y) {
+               yfmt = typeof(y[i]) == "regexp" ? sprintf("@/%s/", y[i]) : 
""y[i]
+               printf("* set: y = %s\n", yfmt)
+               printf("@/%s/ == %s --> %d\n", x, yfmt, x == y[i])
+               printf("@/%s/ ~  %s --> %d\n", x, yfmt, x ~ y[i])
+               printf("@/%s/ <= %s --> %d\n", x, yfmt, x <= y[i])
+               printf("@/%s/ <  %s --> %d\n", x, yfmt, x < y[i])
+       }
+}
diff --git a/test/re_test.ok b/test/re_test.ok
new file mode 100644
index 00000000..e447763a
--- /dev/null
+++ b/test/re_test.ok
@@ -0,0 +1,21 @@
+* set: x = @/bar/
+* set: y = @/bar/
+@/bar/ == @/bar/ --> 1
+@/bar/ ~  @/bar/ --> 1
+@/bar/ <= @/bar/ --> 1
+@/bar/ <  @/bar/ --> 0
+* set: y = @/baz/
+@/bar/ == @/baz/ --> 0
+@/bar/ ~  @/baz/ --> 0
+@/bar/ <= @/baz/ --> 1
+@/bar/ <  @/baz/ --> 1
+* set: y = bar
+@/bar/ == bar --> 1
+@/bar/ ~  bar --> 1
+@/bar/ <= bar --> 1
+@/bar/ <  bar --> 0
+* set: y = baz
+@/bar/ == baz --> 0
+@/bar/ ~  baz --> 0
+@/bar/ <= baz --> 1
+@/bar/ <  baz --> 1

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

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


hooks/post-receive
-- 
gawk



reply via email to

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