Re: Awk split()/array bug in 7.5

2024-05-30 Thread Jeremy Mates
On 2024-05-30 14:56:50 -0600, Todd C. Miller wrote: > This is not a bug. An awk associative array is effectively a hash > table so when you iterate over it like this you are not guaranteed > to get things in any particular order. In fact, our awk, mawk and > gawk all produce different output when

Re: Awk split()/array bug in 7.5

2024-05-30 Thread Karsten Pedersen
Hi, Upon finding out about this "quirk" in the awk language, if you are now horrified that you have loads of code that relies on this order, there is a temporary solution. Check out the WHINY_USERS environment variable: https://linux.die.net/man/1/mawk In mawk and (apparently) undocumented in

Re: Awk split()/array bug in 7.5

2024-05-30 Thread Jeff Penn
Todd, Thanks for the explanation. Jeff On Thu, 30 May 2024 at 21:56, Todd C. Miller wrote: > > On Thu, 30 May 2024 21:42:08 +0100, Jeff Penn wrote: > > > I spotted the following issue, which is also present in FreeBSD. > > > > $ awk -V > > awk version 20240122 > > $ awk 'BEGIN {split("A B C", AB

Re: Awk split()/array bug in 7.5

2024-05-30 Thread Todd C . Miller
On Thu, 30 May 2024 21:42:08 +0100, Jeff Penn wrote: > I spotted the following issue, which is also present in FreeBSD. > > $ awk -V > awk version 20240122 > $ awk 'BEGIN {split("A B C", ABC, " ");for (x in ABC) {print x}}' > 2 > 3 > 1 This is not a bug. An awk associative array is effectively a

Awk split()/array bug in 7.5

2024-05-30 Thread Jeff Penn
I spotted the following issue, which is also present in FreeBSD. $ awk -V awk version 20240122 $ awk 'BEGIN {split("A B C", ABC, " ");for (x in ABC) {print x}}' 2 3 1 FreeBSD 14, awk 20210724: $ awk 'BEGIN {split("A B C", ABC, " ");for (x in ABC) {print x}}' 2 3 1 Linux, mawk 1.3.4 20200120: $ a