[Bug 237699] Hex printing with subr_prf cuts off zero-padded MSB

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed May 1 21:18:02 UTC 2019


            Bug ID: 237699
           Summary: Hex printing with subr_prf cuts off zero-padded MSB
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: contact at knnspeed.com


Using a a print function that uses subr_prf.c with an argument of %#016qx has
the first two padding 0s cut off. This only impacts zeros added by padding, as
data does not get cut. It appears to be an issue in kvprintf in the section
with the "number:" label. I'm trying to print an AVX register, using
%#016qx%qx%qx%qx, but I think this would show up on any architecture on... a
very large number of BSD versions?

I believe it has something to do with this part of the kvprintf "number:"
section--I think 2 characters are being erroneously subtracted, but I haven't
had an opportunity to really read through kvprintf and figure out how to fix
this without accidentally harming anything else:

                        if (!ladjust && padc == '0')
                                dwidth = width - tmp;

I also noticed that FreeBSD uses subr_prf.c V8.3, though I know I've seen a
V8.4 floating around...

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

More information about the freebsd-bugs mailing list