Hi Ed.
Thanks for the report. The diff below seems to fix the problem. I want
to do a little more testing and then will push it to git, along with
your test case.
Thanks for the report,
Arnold
Ed Morton <address@hidden> wrote:
Looks like there's an FPAT bug in gawk 5.0.1:
$ echo ',b' | gawk -v FPAT='[^,]*' '{print $2}'
b
$ echo ',b' | gawk -v FPAT='[^,]*' '{print $1, $2}'
$
It can be worked around in the same way as a previous bug
(https://lists.gnu.org/archive/html/bug-gawk/2017-04/msg00000.html):
$ echo ',b' | gawk -v FPAT='[^,]*' '{oFPAT=FPAT; FPAT=""; FPAT=oFPAT;
print $1, $2}'
??b
$
Regards,
?????? Ed.
-------------------------------------
diff --git a/field.c b/field.c
index 8814233a..e4dd66a3 100644
--- a/field.c
+++ b/field.c
@@ -916,17 +916,6 @@ get_field(long requested, Func_ptr *assign)
*/
if (parse_extent == fields_arr[0]->stptr + fields_arr[0]->stlen)
NF = parse_high_water;
- else if (parse_field == fpat_parse_field) {
- /* FPAT parsing is weird, isolate the special cases */
- char *rec_start = fields_arr[0]->stptr;
- char *rec_end = fields_arr[0]->stptr +
fields_arr[0]->stlen;
-
- if ( parse_extent > rec_end
- || (parse_extent > rec_start && parse_extent < rec_end
&& requested == UNLIMITED-1))
- NF = parse_high_water;
- else if (parse_extent == rec_start) /* could be no
match for FPAT */
- NF = 0;
- }
if (requested == UNLIMITED - 1) /* UNLIMITED-1 means set NF */
requested = parse_high_water;
}