]> git.pld-linux.org Git - packages/gawk.git/blame - gawk-4.2.1-003-fix-rebuilding-records-if-using-API-parser.patch
- rel 2; upstream fixes used in fc
[packages/gawk.git] / gawk-4.2.1-003-fix-rebuilding-records-if-using-API-parser.patch
CommitLineData
9169c9b5
AM
1From 50f617427403434dcca156fb081c1bdc7eb714b7 Mon Sep 17 00:00:00 2001
2From: "Arnold D. Robbins" <arnold@skeeve.com>
3Date: Tue, 17 Apr 2018 15:44:57 +0300
4Subject: [PATCH] Fix problem with rebuilding records if using API parser.
5
6---
7 field.c | 5 +++++
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
13
14diff --git a/field.c b/field.c
15index 0d7e633..5296324 100644
16--- a/field.c
17+++ b/field.c
18@@ -338,6 +338,11 @@ reset_record()
19 {
20 fields_arr[0] = force_string(fields_arr[0]);
21 purge_record();
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());
26+ }
27 }
28
29 static void
30diff --git a/test/Makefile.am b/test/Makefile.am
31index 93a6ee5..f554606 100644
32--- a/test/Makefile.am
33+++ b/test/Makefile.am
34@@ -906,6 +906,7 @@ EXTRA_DIST = \
35 readbuf.ok \
36 readdir.awk \
37 readdir0.awk \
38+ readdir_retest.awk \
39 readfile2.awk \
40 readfile2.ok \
41 rebrackloc.awk \
42@@ -1321,7 +1322,7 @@ SHLIB_TESTS = \
43 getfile \
44 inplace1 inplace2 inplace3 \
45 ordchr ordchr2 \
46- readdir readdir_test readfile readfile2 revout \
47+ readdir readdir_test readdir_retest readfile readfile2 revout \
48 revtwoway rwarray \
49 testext time
50
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 _$@
54
55+readdir_retest:
56+ @echo $@
57+ @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok
58+ @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@
59+ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
60+
61 fts:
62 @case `uname` in \
63 IRIX) \
64@@ -2500,6 +2507,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
65 clean-local:
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 \
69 mmap8k.ok profile1.ok
70
71 # An attempt to print something that can be grepped for in build logs
72diff --git a/test/Makefile.in b/test/Makefile.in
73index 2358988..4133b58 100644
74--- a/test/Makefile.in
75+++ b/test/Makefile.in
76@@ -1164,6 +1164,7 @@ EXTRA_DIST = \
77 readbuf.ok \
78 readdir.awk \
79 readdir0.awk \
80+ readdir_retest.awk \
81 readfile2.awk \
82 readfile2.ok \
83 rebrackloc.awk \
84@@ -1574,7 +1575,7 @@ SHLIB_TESTS = \
85 getfile \
86 inplace1 inplace2 inplace3 \
87 ordchr ordchr2 \
88- readdir readdir_test readfile readfile2 revout \
89+ readdir readdir_test readdir_retest readfile readfile2 revout \
90 revtwoway rwarray \
91 testext time
92
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 _$@
96
97+readdir_retest:
98+ @echo $@
99+ @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok
100+ @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@
101+ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
102+
103 fts:
104 @case `uname` in \
105 IRIX) \
106@@ -4654,6 +4661,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
107 clean-local:
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
112
113 # An attempt to print something that can be grepped for in build logs
114diff --git a/test/readdir_retest.awk b/test/readdir_retest.awk
115new file mode 100644
116index 0000000..079a993
117--- /dev/null
118+++ b/test/readdir_retest.awk
119@@ -0,0 +1,7 @@
120+# Test field values after reparsing
121+FNR == 1 { record1 = $0 }
122+{
123+ printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4
124+ $0 = record1
125+ printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4
126+}
127--
1282.14.4
129
This page took 0.035296 seconds and 4 git commands to generate.