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-4984-g743c5f88


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4984-g743c5f88
Date: Tue, 31 Jan 2023 13:46:45 -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.2-stable has been updated
       via  743c5f88b9cb030a53fe0c0aa0067507a9d50188 (commit)
       via  ac8094ab1fefaf43e35802531e290dc7df896a37 (commit)
      from  6e195e45a972b9c88ab8c5627d09049268b29df0 (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=743c5f88b9cb030a53fe0c0aa0067507a9d50188

commit 743c5f88b9cb030a53fe0c0aa0067507a9d50188
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jan 31 20:46:24 2023 +0200

    Fix field assignment bug.

diff --git a/ChangeLog b/ChangeLog
index 055515c3..f5a33e0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,11 @@
        reproducer.
        Also, update the copyright year.
 
+       * interpret.h (r_interpret): Op_assign case, don't unref the
+       old lhs NODE until after the assignment. See test case in
+       the comment in the code and test/fieldassign.awk. Thanks to
+       Yasuhiro Yamada <yamada@gr3.ie> for the report.
+
 2023-01-22         Arnold D. Robbins     <arnold@skeeve.com>
 
        * main.c: Update copyright year.
diff --git a/interpret.h b/interpret.h
index dff76ec2..3d663bf1 100644
--- a/interpret.h
+++ b/interpret.h
@@ -874,16 +874,30 @@ mod:
                        break;
 
                case Op_assign:
+               {
+                       NODE *save_lhs;
+
                        lhs = POP_ADDRESS();
                        r = TOP_SCALAR();
-                       unref(*lhs);
+                       /*
+                        * 1/2023:
+                        * The old NODE pointed to by *lhs has to be freed.
+                        * But we can't free it too early, in case it's both $0 
and $1
+                        * (Test case was gawk 'gsub(/./, "@") && $0=$1'). So 
we save
+                        * the old one, and after the assignment, we free it, 
since
+                        * $0 and $1 have the same stptr value but only $0 has 
MALLOC
+                        * in the flags. Whew!
+                        */
+                       save_lhs = *lhs;
                        if (r->type == Node_elem_new) {
                                DEREF(r);
                                r = dupnode(Nnull_string);
                        }
                        UPREF(r);
                        UNFIELD(*lhs, r);
+                       unref(save_lhs);
                        REPLACE(r);
+               }
                        break;
 
                case Op_subscript_assign:
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 1a84a1ae..d45600d5 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2023-01-31         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.tst: Regenerated.
+
 2022-11-25         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index b475005c..1cb6f869 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -153,7 +153,8 @@ BASIC_TESTS = \
        delarprm delfunc dfacheck2 dfamb1 dfastress divzero divzero2 \
        dynlj eofsplit \
        eofsrc1 escapebrace exit2 exitval1 exitval2 exitval3 fcall_exit \
-       fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
+       fcall_exit2 \
+       fieldassign fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
        fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \
        fsrs fsspcoln fstabplus funsemnl funsmnam funstack getline \
        getline2 getline3 getline4 getline5 getlnbuf getlnfa getnr2tb \
@@ -1628,6 +1629,11 @@ fcall_exit2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+fieldassign:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 fldchg:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index 1da93514..97cfd1c6 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -4,6 +4,9 @@
        * elemnew1.awk, elemnew1.ok: New files.
        Also, update the copyright year.
 
+       * Makefile.am (EXTRA_DIST): New test: fieldassign.
+       * fieldassign.awk, fieldassign.in, fieldassign.ok: New files.
+
 2023-01-22         Arnold D. Robbins     <arnold@skeeve.com>
 
        * makepmafile.c (main): Make the file mode 0600.
diff --git a/test/Makefile.am b/test/Makefile.am
index 09e56e92..24ae6787 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -318,6 +318,9 @@ EXTRA_DIST = \
        fcall_exit2.ok \
        fflush.ok \
        fflush.sh \
+       fieldassign.awk \
+       fieldassign.in \
+       fieldassign.ok \
        fieldwdth.awk \
        fieldwdth.in \
        fieldwdth.ok \
@@ -1459,7 +1462,8 @@ BASIC_TESTS = \
        delarprm delfunc dfacheck2 dfamb1 dfastress divzero divzero2 \
        dynlj eofsplit \
        eofsrc1 escapebrace exit2 exitval1 exitval2 exitval3 fcall_exit \
-       fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
+       fcall_exit2 \
+       fieldassign fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
        fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \
        fsrs fsspcoln fstabplus funsemnl funsmnam funstack getline \
        getline2 getline3 getline4 getline5 getlnbuf getlnfa getnr2tb \
diff --git a/test/Makefile.in b/test/Makefile.in
index b5d1d9e6..8feff4ee 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -586,6 +586,9 @@ EXTRA_DIST = \
        fcall_exit2.ok \
        fflush.ok \
        fflush.sh \
+       fieldassign.awk \
+       fieldassign.in \
+       fieldassign.ok \
        fieldwdth.awk \
        fieldwdth.in \
        fieldwdth.ok \
@@ -1727,7 +1730,8 @@ BASIC_TESTS = \
        delarprm delfunc dfacheck2 dfamb1 dfastress divzero divzero2 \
        dynlj eofsplit \
        eofsrc1 escapebrace exit2 exitval1 exitval2 exitval3 fcall_exit \
-       fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
+       fcall_exit2 \
+       fieldassign fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \
        fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fscaret fsnul1 \
        fsrs fsspcoln fstabplus funsemnl funsmnam funstack getline \
        getline2 getline3 getline4 getline5 getlnbuf getlnfa getnr2tb \
@@ -3390,6 +3394,11 @@ fcall_exit2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+fieldassign:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 fldchg:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 98245c37..5d7dcee3 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -327,6 +327,11 @@ fcall_exit2:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+fieldassign:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 fldchg:
        @echo $@
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
diff --git a/test/fieldassign.awk b/test/fieldassign.awk
new file mode 100644
index 00000000..631775b1
--- /dev/null
+++ b/test/fieldassign.awk
@@ -0,0 +1 @@
+gsub(/./, "@") && $0 = $1
diff --git a/test/fieldassign.in b/test/fieldassign.in
new file mode 100644
index 00000000..5f5521fa
--- /dev/null
+++ b/test/fieldassign.in
@@ -0,0 +1,2 @@
+abc
+def
diff --git a/test/fieldassign.ok b/test/fieldassign.ok
new file mode 100644
index 00000000..11e9cfd5
--- /dev/null
+++ b/test/fieldassign.ok
@@ -0,0 +1,2 @@
+@@@
+@@@

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=ac8094ab1fefaf43e35802531e290dc7df896a37

commit ac8094ab1fefaf43e35802531e290dc7df896a37
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jan 31 20:38:48 2023 +0200

    Yet another fix for Node_elem_new handling.

diff --git a/ChangeLog b/ChangeLog
index d9f31be0..055515c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-01-31         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * interpret.h (r_interpret): For op_subscript, upref the variable
+       if it's Node_var, also. Thanks to Volodymyr Gubarkov <xonixx@gmail.com>
+       for the initial report and to Vincent Forest
+       <vincent.forest@meso-star.com> for help in getting a small
+       reproducer.
+       Also, update the copyright year.
+
 2023-01-22         Arnold D. Robbins     <arnold@skeeve.com>
 
        * main.c: Update copyright year.
diff --git a/interpret.h b/interpret.h
index 4540d302..dff76ec2 100644
--- a/interpret.h
+++ b/interpret.h
@@ -3,7 +3,7 @@
  */
 
 /* 
- * Copyright (C) 1986, 1988, 1989, 1991-2022,
+ * Copyright (C) 1986, 1988, 1989, 1991-2023,
  * the Free Software Foundation, Inc.
  * 
  * This file is part of GAWK, the GNU implementation of the
@@ -344,7 +344,9 @@ uninitialized_scalar:
                                }
                        }
 
-                       if (r->type == Node_val || r->type == Node_elem_new)
+                       if (r->type == Node_val
+                           || r->type == Node_var
+                           || r->type == Node_elem_new)
                                UPREF(r);
                        PUSH(r);
                        break;
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 91ad0480..b475005c 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -192,7 +192,7 @@ GAWK_EXT_TESTS = \
        clos1way5 clos1way6 colonwarn commas crlf dbugeval dbugeval2 \
        dbugeval3 dbugeval4 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dfacheck1 dumpvars \
-       errno exit fieldwdth forcenum fpat1 fpat2 \
+       elemnew1 errno exit fieldwdth forcenum fpat1 fpat2 \
        fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull fsfwfs functab1 \
        functab2 functab3 functab6 funlen fwtest fwtest2 fwtest3 fwtest4 \
        fwtest5 fwtest6 fwtest7 fwtest8 genpot gensub gensub2 gensub3 \
@@ -2749,6 +2749,11 @@ dfacheck1:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+elemnew1:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 exit:
        @echo $@
        @-$(LOCALES) AWK="$(AWKPROG)" "$(srcdir)"/$@.sh  > _$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index 9855113e..1da93514 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2023-01-31         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * Makefile.am (EXTRA_DIST): New test: elemnew1.
+       * elemnew1.awk, elemnew1.ok: New files.
+       Also, update the copyright year.
+
 2023-01-22         Arnold D. Robbins     <arnold@skeeve.com>
 
        * makepmafile.c (main): Make the file mode 0600.
@@ -16,7 +22,6 @@
 
 2022-11-03  Eli Zaretskii  <eliz@gnu.org>
 
-       * Makefile.in (EXPECTED_FAIL_MINGW):
        * Makefile.am (EXPECTED_FAIL_MINGW): Add dbugeval4.
 
 2022-10-23         Arnold D. Robbins     <arnold@skeeve.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index d8d8081e..09e56e92 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
 #
 # test/Makefile.am --- automake input file for gawk
 #
-# Copyright (C) 1988-2022 the Free Software Foundation, Inc.
+# Copyright (C) 1988-2023 the Free Software Foundation, Inc.
 #
 # This file is part of GAWK, the GNU implementation of the
 # AWK Programming Language.
@@ -287,6 +287,8 @@ EXTRA_DIST = \
        dumpvars.ok \
        dynlj.awk \
        dynlj.ok \
+       elemnew1.awk \
+       elemnew1.ok \
        escapebrace.awk \
        escapebrace.in \
        escapebrace.ok \
@@ -1496,7 +1498,7 @@ GAWK_EXT_TESTS = \
        clos1way5 clos1way6 colonwarn commas crlf dbugeval dbugeval2 \
        dbugeval3 dbugeval4 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dfacheck1 dumpvars \
-       errno exit fieldwdth forcenum fpat1 fpat2 \
+       elemnew1 errno exit fieldwdth forcenum fpat1 fpat2 \
        fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull fsfwfs functab1 \
        functab2 functab3 functab6 funlen fwtest fwtest2 fwtest3 fwtest4 \
        fwtest5 fwtest6 fwtest7 fwtest8 genpot gensub gensub2 gensub3 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 1d116637..b5d1d9e6 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -17,7 +17,7 @@
 #
 # test/Makefile.am --- automake input file for gawk
 #
-# Copyright (C) 1988-2022 the Free Software Foundation, Inc.
+# Copyright (C) 1988-2023 the Free Software Foundation, Inc.
 #
 # This file is part of GAWK, the GNU implementation of the
 # AWK Programming Language.
@@ -555,6 +555,8 @@ EXTRA_DIST = \
        dumpvars.ok \
        dynlj.awk \
        dynlj.ok \
+       elemnew1.awk \
+       elemnew1.ok \
        escapebrace.awk \
        escapebrace.in \
        escapebrace.ok \
@@ -1764,7 +1766,7 @@ GAWK_EXT_TESTS = \
        clos1way5 clos1way6 colonwarn commas crlf dbugeval dbugeval2 \
        dbugeval3 dbugeval4 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dfacheck1 dumpvars \
-       errno exit fieldwdth forcenum fpat1 fpat2 \
+       elemnew1 errno exit fieldwdth forcenum fpat1 fpat2 \
        fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull fsfwfs functab1 \
        functab2 functab3 functab6 funlen fwtest fwtest2 fwtest3 fwtest4 \
        fwtest5 fwtest6 fwtest7 fwtest8 genpot gensub gensub2 gensub3 \
@@ -4503,6 +4505,11 @@ dfacheck1:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+elemnew1:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 exit:
        @echo $@
        @-$(LOCALES) AWK="$(AWKPROG)" "$(srcdir)"/$@.sh  > _$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index f708f055..98245c37 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1442,6 +1442,11 @@ dfacheck1:
        @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  < "$(srcdir)"/$@.in >_$@ 2>&1 
|| echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
 
+elemnew1:
+       @echo $@
+       @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: 
$$? >>_$@
+       @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
 exit:
        @echo $@
        @-$(LOCALES) AWK="$(AWKPROG)" "$(srcdir)"/$@.sh  > _$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
diff --git a/test/elemnew1.awk b/test/elemnew1.awk
new file mode 100644
index 00000000..36d3de16
--- /dev/null
+++ b/test/elemnew1.awk
@@ -0,0 +1,8 @@
+ function tailmatch(string) {
+   length(string)
+ }
+
+ BEGIN {
+     tailmatch(defanchors["test"])
+     defanchors["test"] = defanchors["test"]
+ }
diff --git a/test/elemnew1.ok b/test/elemnew1.ok
new file mode 100644
index 00000000..e69de29b

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

Summary of changes:
 ChangeLog                          | 14 ++++++++++++++
 interpret.h                        | 22 +++++++++++++++++++---
 pc/ChangeLog                       |  4 ++++
 pc/Makefile.tst                    | 15 +++++++++++++--
 test/ChangeLog                     | 10 +++++++++-
 test/Makefile.am                   | 12 +++++++++---
 test/Makefile.in                   | 22 +++++++++++++++++++---
 test/Maketests                     | 10 ++++++++++
 test/elemnew1.awk                  |  8 ++++++++
 test/{arrayprm2.ok => elemnew1.ok} |  0
 test/fieldassign.awk               |  1 +
 test/{fwtest.in => fieldassign.in} |  1 +
 test/fieldassign.ok                |  2 ++
 13 files changed, 109 insertions(+), 12 deletions(-)
 create mode 100644 test/elemnew1.awk
 copy test/{arrayprm2.ok => elemnew1.ok} (100%)
 create mode 100644 test/fieldassign.awk
 copy test/{fwtest.in => fieldassign.in} (50%)
 create mode 100644 test/fieldassign.ok


hooks/post-receive
-- 
gawk



reply via email to

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