[Bug 15041] New: [PATCH] Awk: fix printf format when using large numbers
bugzilla at busybox.net
bugzilla at busybox.net
Sat Oct 8 18:52:16 UTC 2022
https://bugs.busybox.net/show_bug.cgi?id=15041
Bug ID: 15041
Summary: [PATCH] Awk: fix printf format when using large
numbers
Product: Busybox
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: caribpa at outlook.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
Created attachment 9381
--> https://bugs.busybox.net/attachment.cgi?id=9381&action=edit
awk-printf-fix-format-large-numbers.patch
Hi!
I noticed that Busybox awk truncates double to int when printing as %d, %i, %u,
%o, or %x [1][2]. This means that expected information is lost, for example:
awk 'BEGIN{printf "0x%x\n", 4294967290}'
returns 0x80000000 (or 0x7fffffff in some platforms) instead of 0xfffffffa,
like it happens in at least gawk, mawk, and nawk.
The patch attached simply changes the int casting into long long and removes
the TODO comment.
Cheers,
Carlos
[1] -
https://git.busybox.net/busybox/tree/editors/awk.c?id=c8c1fcdba163f264a503380bc63485aacd09214c#n929
[2] -
https://git.busybox.net/busybox/tree/editors/awk.c?id=c8c1fcdba163f264a503380bc63485aacd09214c#n2418
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list