[Bug 12506] New: printf in awk fails to print zeros

bugzilla at busybox.net bugzilla at busybox.net
Sat Jan 25 22:43:11 UTC 2020


            Bug ID: 12506
           Summary: printf in awk fails to print zeros
           Product: Busybox
           Version: 1.31.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: yuri at rawbw.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

In an attempt to transfer a binary file to the box over the terminal connection
I converted the binary to an ASCII file with decimal ASCII codes in it.
However, awk fails to recover the content due to it losing zeros (and maybe
other characters):

In BusyBox v1.31.0 zeros are lost:
> # (echo 0; echo 1; echo 2) | awk '{ printf("%c",$0); }' | hexdump 
> 0000000 0201                                   
> 0000002

As a comparison, on FreeBSD all bytes are recovered:
> $ (echo 0; echo 1; echo 2) | awk '{ printf("%c",$0); }' | hd
> 00000000  00 01 02                                          |...|
> 00000003

There is no practical benefit to losing zeros. This can only hurt operations in
an embedded system where BusyBox is typically used.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the busybox-cvs mailing list