1 From 50f617427403434dcca156fb081c1bdc7eb714b7 Mon Sep 17 00:00:00 2001
2 From: "Arnold D. Robbins" <arnold@skeeve.com>
3 Date: Tue, 17 Apr 2018 15:44:57 +0300
4 Subject: [PATCH] Fix problem with rebuilding records if using API parser.
8 test/Makefile.am | 10 +++++++++-
9 test/Makefile.in | 10 +++++++++-
10 test/readdir_retest.awk | 7 +++++++
11 4 files changed, 30 insertions(+), 2 deletions(-)
12 create mode 100644 test/readdir_retest.awk
14 diff --git a/field.c b/field.c
15 index 0d7e633..5296324 100644
18 @@ -338,6 +338,11 @@ reset_record()
20 fields_arr[0] = force_string(fields_arr[0]);
22 + if (api_parser_override) {
23 + api_parser_override = false;
24 + parse_field = normal_parse_field;
25 + update_PROCINFO_str("FS", current_field_sep_str());
30 diff --git a/test/Makefile.am b/test/Makefile.am
31 index 93a6ee5..f554606 100644
32 --- a/test/Makefile.am
33 +++ b/test/Makefile.am
34 @@ -906,6 +906,7 @@ EXTRA_DIST = \
38 + readdir_retest.awk \
42 @@ -1321,7 +1322,7 @@ SHLIB_TESTS = \
44 inplace1 inplace2 inplace3 \
46 - readdir readdir_test readfile readfile2 revout \
47 + readdir readdir_test readdir_retest readfile readfile2 revout \
51 @@ -2279,6 +2280,12 @@ readdir_test:
52 @$(AWK) -lreaddir_test '{printf "[%s] [%s] [%s] [%s]\n", $$1, $$2, $$3, $$4}' "$(top_srcdir)" > _$@
53 @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
57 + @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok
58 + @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@
59 + @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
64 @@ -2500,6 +2507,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
66 rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \
67 seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \
68 + readdir_test.ok readdir_retest.ok \
71 # An attempt to print something that can be grepped for in build logs
72 diff --git a/test/Makefile.in b/test/Makefile.in
73 index 2358988..4133b58 100644
74 --- a/test/Makefile.in
75 +++ b/test/Makefile.in
76 @@ -1164,6 +1164,7 @@ EXTRA_DIST = \
80 + readdir_retest.awk \
84 @@ -1574,7 +1575,7 @@ SHLIB_TESTS = \
86 inplace1 inplace2 inplace3 \
88 - readdir readdir_test readfile readfile2 revout \
89 + readdir readdir_test readdir_retest readfile readfile2 revout \
93 @@ -2719,6 +2720,12 @@ readdir_test:
94 @$(AWK) -lreaddir_test '{printf "[%s] [%s] [%s] [%s]\n", $$1, $$2, $$3, $$4}' "$(top_srcdir)" > _$@
95 @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
99 + @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok
100 + @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@
101 + @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
106 @@ -4654,6 +4661,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
108 rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \
109 seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \
110 + readdir_test.ok readdir_retest.ok \
111 mmap8k.ok profile1.ok
113 # An attempt to print something that can be grepped for in build logs
114 diff --git a/test/readdir_retest.awk b/test/readdir_retest.awk
116 index 0000000..079a993
118 +++ b/test/readdir_retest.awk
120 +# Test field values after reparsing
121 +FNR == 1 { record1 = $0 }
123 + printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4
125 + printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4