diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2023-04-13 21:30:44 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2023-04-13 21:30:44 +0300 |
commit | 818e413643676b2fd2ab2bf272af6be5bb79e5b2 (patch) | |
tree | 768a62ae9f1c0ec47bddbb0cb0fbd01da3904487 | |
parent | a5400a3f7efa49111d0d0d9e7972ce5a4eddd4fa (diff) | |
parent | b930d79a316d08c899787c0d2e39865913863a52 (diff) | |
download | gawk-818e413643676b2fd2ab2bf272af6be5bb79e5b2.tar.gz |
Merge branch 'gawk-5.2-stable'
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | array.c | 22 | ||||
-rw-r--r-- | pc/ChangeLog | 1 | ||||
-rw-r--r-- | pc/Makefile.tst | 6 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/Makefile.in | 12 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/asortsymtab.awk | 10 | ||||
-rw-r--r-- | test/asortsymtab.ok | 72 |
10 files changed, 136 insertions, 10 deletions
@@ -1,3 +1,9 @@ +2023-04-13 Arnold D. Robbins <arnold@skeeve.com> + + * array.c (asort_actual): Handle Node_var_new. Can happen + if you sort SYMTAB. Thanks to zhou shuiqing + <zhoushuiqing321@outlook.com> for the report. + 2023-04-13 Andrew J. Schorr <aschorr@telemetry-investments.com> * io.c (csvscan): Convert CR-LF pairs to plain LF, both at the @@ -935,17 +935,24 @@ asort_actual(int nargs, sort_context_t ctxt) NODE *value; - if (r->type == Node_val) + switch (r->type) { + case Node_val: value = dupnode(r); - else if (r->type == Node_var) + break; + case Node_var: /* SYMTAB ... */ value = dupnode(r->var_value); - else if (r->type == Node_builtin_func - || r->type == Node_func - || r->type == Node_ext_func) { + break; + case Node_var_new: + value = dupnode(Nnull_string); + break; + case Node_builtin_func: + case Node_func: + case Node_ext_func: /* FUNCTAB ... */ value = make_string(r->vname, strlen(r->vname)); - } else { + break; + case Node_var_array: NODE *arr; arr = make_array(); subs = force_string(subs); @@ -956,6 +963,9 @@ asort_actual(int nargs, sort_context_t ctxt) arr->parent_array = array; /* actual parent, not the temporary one. */ value = assoc_copy(r, arr); + break; + default: + cant_happen("asort_actual: got unexpected type %s", nodetype2str(r->type)); } assoc_set(result, subs, value); } diff --git a/pc/ChangeLog b/pc/ChangeLog index 2f7cca17..58164fde 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -2,6 +2,7 @@ * Makefile.tst: Regenerated. * config.h: Regenerated. + * Makefile.tst: Regenerated. 2023-03-24 Arnold D. Robbins <arnold@skeeve.com> diff --git a/pc/Makefile.tst b/pc/Makefile.tst index 7af87c3c..fef82ef7 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -189,6 +189,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \ arraysort2 arraytype asortbool backw badargs beginfile1 beginfile2 \ + asortsymtab \ binmode1 charasbytes clos1way clos1way2 clos1way3 clos1way4 \ clos1way5 clos1way6 colonwarn commas crlf csv1 csv2 csv3 csvodd \ dbugeval dbugeval2 \ @@ -2680,6 +2681,11 @@ backw: @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +asortsymtab: + @echo $@ + @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + clos1way: @echo $@ @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=C; export GAWKLOCALE; \ diff --git a/test/ChangeLog b/test/ChangeLog index 43da1b6a..ca6dfe64 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -6,6 +6,11 @@ 2023-04-13 Arnold D. Robbins <arnold@skeeve.com> + * Makefile.am (EXTRA_DIST): New test: asortsymtab. + * asortsymtab.awk, asortsymtab.ok: New files. + +2023-04-13 Arnold D. Robbins <arnold@skeeve.com> + * badargs.ok: Update after code changes. 2023-04-07 zhou shuiqing <zhoushuiqing321@outlook.com> diff --git a/test/Makefile.am b/test/Makefile.am index fb1bf7be..1099a620 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -127,15 +127,17 @@ EXTRA_DIST = \ asgext.ok \ asort.awk \ asort.ok \ + asortbool.awk \ + asortbool.ok \ asorti.awk \ asorti.ok \ + asortsymtab.awk \ + asortsymtab.ok \ assignnumfield.awk \ assignnumfield.in \ assignnumfield.ok \ assignnumfield2.awk \ assignnumfield2.ok \ - asortbool.awk \ - asortbool.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -1515,6 +1517,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \ arraysort2 arraytype asortbool backw badargs beginfile1 beginfile2 \ + asortsymtab \ binmode1 charasbytes clos1way clos1way2 clos1way3 clos1way4 \ clos1way5 clos1way6 colonwarn commas crlf csv1 csv2 csv3 csvodd \ dbugeval dbugeval2 \ diff --git a/test/Makefile.in b/test/Makefile.in index b6cd07cc..ff0ef955 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -391,15 +391,17 @@ EXTRA_DIST = \ asgext.ok \ asort.awk \ asort.ok \ + asortbool.awk \ + asortbool.ok \ asorti.awk \ asorti.ok \ + asortsymtab.awk \ + asortsymtab.ok \ assignnumfield.awk \ assignnumfield.in \ assignnumfield.ok \ assignnumfield2.awk \ assignnumfield2.ok \ - asortbool.awk \ - asortbool.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -1779,6 +1781,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \ arraysort2 arraytype asortbool backw badargs beginfile1 beginfile2 \ + asortsymtab \ binmode1 charasbytes clos1way clos1way2 clos1way3 clos1way4 \ clos1way5 clos1way6 colonwarn commas crlf csv1 csv2 csv3 csvodd \ dbugeval dbugeval2 \ @@ -4454,6 +4457,11 @@ backw: @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +asortsymtab: + @echo $@ + @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + clos1way: @echo $@ @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=C; export GAWKLOCALE; \ diff --git a/test/Maketests b/test/Maketests index 165f143b..945cb43d 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1370,6 +1370,11 @@ backw: @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +asortsymtab: + @echo $@ + @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + clos1way: @echo $@ @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=C; export GAWKLOCALE; \ diff --git a/test/asortsymtab.awk b/test/asortsymtab.awk new file mode 100644 index 00000000..7cb65a69 --- /dev/null +++ b/test/asortsymtab.awk @@ -0,0 +1,10 @@ +BEGIN { + asort(SYMTAB, arr) + for (idx in arr) { + print idx + } + asort(FUNCTAB, arr) + for (idx in arr) { + print idx + } +} diff --git a/test/asortsymtab.ok b/test/asortsymtab.ok new file mode 100644 index 00000000..9b4799bf --- /dev/null +++ b/test/asortsymtab.ok @@ -0,0 +1,72 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 |