[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] livepatch-build-tools: remove usage of gawk



On 24/11/2023 11:43, Ross Lagerwall wrote:
> On Thu, Nov 23, 2023 at 4:08 PM Roger Pau Monne <roger.pau@xxxxxxxxxx> wrote:
>>
>> And instead use plain awk.
>>
>> There's no need to use the --non-decimal-data option for gawk, since the
>> numbers that we want to print are already prefixed with '0x', and so plain awk
>> will do the conversion from hexadecimal to decimal just fine.
>
> I don't think that's true (at least with gnu awk 5.1.1):
>
> $ echo '<e98b7>   DW_AT_byte_size   : 0x14' | awk '{printf("%d\n", $4)}'
> 0
>

I think it's a FreeBSD quirk. From their man page:

> Historically, awk did not accept "0x" as a hex string. However, since > One True Awk used strtod to convert strings to floats, and since "0x12" > is a valid hexadecimal representation of a floating point number, On > FreeBSD, awk has accepted this notation as an extension since One True > Awk was imported in FreeBSD 5.0. Upstream One True Awk has restored > the historical behavior for better compatibility between the different > awk implementations. Both gawk and mawk already behave similarly. > Starting with FreeBSD 14.0 awk will no longer accept this extension.

I'm guessing the latest FreeBSD doesn't have that behaviour either?

Cheers,
Alejandro



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.