Busybox awk on 64-bit architectures?
Mike Frysinger
vapier at gentoo.org
Tue Sep 27 03:15:35 UTC 2005
On Thursday 01 September 2005 02:10 am, Rob Landley wrote:
> Somebody says that awk is broken on amd64, because
> sizeof(long)!=sizeof(int) and this causes dandruff and makes milk go bad
> faster:
actually, this seems to be somewhat on the mark (btw, i can confirm the bug on
my amd64) ... poking through the code makes me think that the bug is actually
that much of the codebased assumes sizeof(long) == 4
there's a bunch of places where variables are used as bitfields and when bits
are shifted off, the result should simply be truncated to 32 bits
for example, if we look a few lines below the proposed fix:
if (nargs < (info >> 30))
runtime_error(EMSG_TOO_FEW_ARGS);
on a 64bit machine this test fails ... but if we truncate nargs and info to
32bits before hand, the code 'works' ...
> C) awk is full of other "unsigned long"
> instances, D) this patch takes an assignment between "unsigned long" and
> "unsigned long" and sticks a typedef in there to something else. (There's
> no _way_ that's the correct fix to whatever the problem is...)
the correct fix i believe would be to basically run like:
sed -i "s:unsigned long:uint32_t:" editors/awk.c
/me tries it ...
yep, provided test case starts working on my amd64
-mike
More information about the busybox
mailing list