[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: gawk vs. BusyBox awk treatment of FS empty matches
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2020-11-16 9:47:13
Message-ID: CAK1hOcM42kvrBNDyu+cwc-mFX3Vf1JkaOwBFQBY0Vs+ZEMLYCg () mail ! gmail ! com
[Download RAW message or body]

On Sun, Nov 1, 2020 at 9:10 PM David Čepelík <david.cepelik@showmax.com> wrote:
> I've noticed an interesting discrepancy between gawk and BusyBox awk:
> when the FS is set to e.g. ` *` (space asterisk), gawk will not consider
> empty matches of the regular expression (see e.g. [1]) while BusyBox
> will. This example demonstrates it:
>
> ~% gawk --version
> GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.0)
> [...]
> ~% echo 'foo bar' | gawk -F' *' '{print $1}'
> foo
>
> While BusyBox (a7c065354) will produce:
>
> 1! ~/sw/3rd/busybox:master% echo 'foo bar' | ./busybox awk -F' *'  '{print $1}'
> f
>
> Is this desired behavior? To my best knowledge, this isn't standardized.
> Would it make sense to harmonize BusyBox's implementation with GNU Awk?
>
> This caused a problem in a 3rd-party script I was using and which
> stopped working after being migrated to Alpine Linux.
>
> Please let me know if I can provide further details. I'm happy to
> provide a patch if that's the desired solution.

Yes, following gawk is likely to be most useful for the users.
Please send the patch.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic