[Bug 195584] New: patch: fix %c in awk's printf when printing a number near 0

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Dec 2 20:44:45 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195584

            Bug ID: 195584
           Summary: patch: fix %c in awk's printf when printing a number
                    near 0
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: naddy at FreeBSD.org

Created attachment 150103
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150103&action=edit
fix %c in awk's printf when printing a number near 0

The awk bug described here
http://marc.info/?l=openbsd-misc&m=141735117703872&w=2
and fixed here
http://marc.info/?l=openbsd-tech&m=141739334413710&w=2
also applies to FreeBSD.

How to reproduce:

$ awk 'END { printf "%c", 0 }' </dev/null | hd
00000000  00                                                |.|
00000001
$ awk 'END { printf "%c", 0.1 }' </dev/null | hd
$ 

awk fails to print a nul byte with %c for floating point values that are
coerced to 0.

Patch attached.  Credit to Jeremy Devenport.  This affects all supported
branches.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list