637a5bcac8
Added: gawk-4.2.1-000-add-support-for-a-and-A-in-printf.patch gawk-4.2.1-001-remove-the-tail-recursion-optimization.patch gawk-4.2.1-002-copy-MPZ-MPFR-bits-also-in-r_dupnode.patch gawk-4.2.1-003-fix-rebuilding-records-if-using-API-parser.patch gawk-4.2.1-004-fix-a-corner-case-with-EPIPE-to-stdout-stderr.patch
130 lines
3.7 KiB
Diff
130 lines
3.7 KiB
Diff
From 50f617427403434dcca156fb081c1bdc7eb714b7 Mon Sep 17 00:00:00 2001
|
|
From: "Arnold D. Robbins" <arnold@skeeve.com>
|
|
Date: Tue, 17 Apr 2018 15:44:57 +0300
|
|
Subject: [PATCH] Fix problem with rebuilding records if using API parser.
|
|
|
|
---
|
|
field.c | 5 +++++
|
|
test/Makefile.am | 10 +++++++++-
|
|
test/Makefile.in | 10 +++++++++-
|
|
test/readdir_retest.awk | 7 +++++++
|
|
4 files changed, 30 insertions(+), 2 deletions(-)
|
|
create mode 100644 test/readdir_retest.awk
|
|
|
|
diff --git a/field.c b/field.c
|
|
index 0d7e633..5296324 100644
|
|
--- a/field.c
|
|
+++ b/field.c
|
|
@@ -338,6 +338,11 @@ reset_record()
|
|
{
|
|
fields_arr[0] = force_string(fields_arr[0]);
|
|
purge_record();
|
|
+ if (api_parser_override) {
|
|
+ api_parser_override = false;
|
|
+ parse_field = normal_parse_field;
|
|
+ update_PROCINFO_str("FS", current_field_sep_str());
|
|
+ }
|
|
}
|
|
|
|
static void
|
|
diff --git a/test/Makefile.am b/test/Makefile.am
|
|
index 93a6ee5..f554606 100644
|
|
--- a/test/Makefile.am
|
|
+++ b/test/Makefile.am
|
|
@@ -906,6 +906,7 @@ EXTRA_DIST = \
|
|
readbuf.ok \
|
|
readdir.awk \
|
|
readdir0.awk \
|
|
+ readdir_retest.awk \
|
|
readfile2.awk \
|
|
readfile2.ok \
|
|
rebrackloc.awk \
|
|
@@ -1321,7 +1322,7 @@ SHLIB_TESTS = \
|
|
getfile \
|
|
inplace1 inplace2 inplace3 \
|
|
ordchr ordchr2 \
|
|
- readdir readdir_test readfile readfile2 revout \
|
|
+ readdir readdir_test readdir_retest readfile readfile2 revout \
|
|
revtwoway rwarray \
|
|
testext time
|
|
|
|
@@ -2279,6 +2280,12 @@ readdir_test:
|
|
@$(AWK) -lreaddir_test '{printf "[%s] [%s] [%s] [%s]\n", $$1, $$2, $$3, $$4}' "$(top_srcdir)" > _$@
|
|
@-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
|
|
|
|
+readdir_retest:
|
|
+ @echo $@
|
|
+ @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok
|
|
+ @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@
|
|
+ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
|
|
+
|
|
fts:
|
|
@case `uname` in \
|
|
IRIX) \
|
|
@@ -2500,6 +2507,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
|
|
clean-local:
|
|
rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \
|
|
seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \
|
|
+ readdir_test.ok readdir_retest.ok \
|
|
mmap8k.ok profile1.ok
|
|
|
|
# An attempt to print something that can be grepped for in build logs
|
|
diff --git a/test/Makefile.in b/test/Makefile.in
|
|
index 2358988..4133b58 100644
|
|
--- a/test/Makefile.in
|
|
+++ b/test/Makefile.in
|
|
@@ -1164,6 +1164,7 @@ EXTRA_DIST = \
|
|
readbuf.ok \
|
|
readdir.awk \
|
|
readdir0.awk \
|
|
+ readdir_retest.awk \
|
|
readfile2.awk \
|
|
readfile2.ok \
|
|
rebrackloc.awk \
|
|
@@ -1574,7 +1575,7 @@ SHLIB_TESTS = \
|
|
getfile \
|
|
inplace1 inplace2 inplace3 \
|
|
ordchr ordchr2 \
|
|
- readdir readdir_test readfile readfile2 revout \
|
|
+ readdir readdir_test readdir_retest readfile readfile2 revout \
|
|
revtwoway rwarray \
|
|
testext time
|
|
|
|
@@ -2719,6 +2720,12 @@ readdir_test:
|
|
@$(AWK) -lreaddir_test '{printf "[%s] [%s] [%s] [%s]\n", $$1, $$2, $$3, $$4}' "$(top_srcdir)" > _$@
|
|
@-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
|
|
|
|
+readdir_retest:
|
|
+ @echo $@
|
|
+ @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok
|
|
+ @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@
|
|
+ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
|
|
+
|
|
fts:
|
|
@case `uname` in \
|
|
IRIX) \
|
|
@@ -4654,6 +4661,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
|
|
clean-local:
|
|
rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \
|
|
seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \
|
|
+ readdir_test.ok readdir_retest.ok \
|
|
mmap8k.ok profile1.ok
|
|
|
|
# An attempt to print something that can be grepped for in build logs
|
|
diff --git a/test/readdir_retest.awk b/test/readdir_retest.awk
|
|
new file mode 100644
|
|
index 0000000..079a993
|
|
--- /dev/null
|
|
+++ b/test/readdir_retest.awk
|
|
@@ -0,0 +1,7 @@
|
|
+# Test field values after reparsing
|
|
+FNR == 1 { record1 = $0 }
|
|
+{
|
|
+ printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4
|
|
+ $0 = record1
|
|
+ printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4
|
|
+}
|
|
--
|
|
2.14.4
|
|
|