awk error as of git / today
Denys Vlasenko
vda.linux at googlemail.com
Sun Jul 11 10:29:11 UTC 2021
Thank you for finding the cause.
Applied, thank you.
On Fri, Jul 9, 2021 at 10:11 AM Ron Yorston <rmy at pobox.com> wrote:
>
> Steffen Nurpmeso wrote:
> > $ AWK="/home/steffen/usr-kent-linux-x86_64/bin/busybox awk" \
> > dash mdocmx.sh mdocmx.1|wc -l
> > 27
>
> Commit 08ca313d7 (awk: simplify tests for operation class) replaced
> tests for operation classes with simple equality tests.
>
> It seems this doesn't work for combinations of print and redirection.
> In that case this code:
>
> case OC_PRINT:
> case OC_PRINTF:
> debug_printf_parse("%s: OC_PRINT[F]\n", __func__);
> n = chain_node(t_info);
> n->l.n = parse_expr(TC_SEMICOL | TC_NEWLINE | TC_OUTRDR | TC_RBRACE);
> if (t_tclass & TC_OUTRDR) {
> n->info |= t_info;
> n->r.n = parse_expr(TC_SEMICOL | TC_NEWLINE | TC_RBRACE);
> }
> if (t_tclass & TC_RBRACE)
> rollback_token();
> break;
>
> combines the print and redirection bits.
>
> Reverting the part of the commit that handles OC_PRINT appears to
> fix the problem. No guarantees, though.
>
> Ron
> ---
> editors/awk.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/editors/awk.c b/editors/awk.c
> index cd135ef64..4dc4d47aa 100644
> --- a/editors/awk.c
> +++ b/editors/awk.c
> @@ -462,8 +462,7 @@ static const uint32_t tokeninfo[] ALIGN4 = {
> 0,
> 0, /* \n */
> ST_IF, ST_DO, ST_FOR, OC_BREAK,
> -#define TI_PRINT OC_PRINT
> - OC_CONTINUE, OC_DELETE|Rx, TI_PRINT,
> + OC_CONTINUE, OC_DELETE|Rx, OC_PRINT,
> OC_PRINTF, OC_NEXT, OC_NEXTFILE,
> OC_RETURN|Vx, OC_EXIT|Nx,
> ST_WHILE,
> @@ -2929,7 +2928,7 @@ static var *evaluate(node *op, var *res)
> F = rsm->F;
> }
>
> - if (opinfo == TI_PRINT) {
> + if ((opinfo & OPCLSMASK) == OC_PRINT) {
> if (!op1) {
> fputs(getvar_s(intvar[F0]), F);
> } else {
> --
> 2.31.1
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list