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

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu May 2 00:55:09 UTC 2019


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

--- Comment #2 from Conrad Meyer <cem at freebsd.org> ---
For better or worse, our printf(9) includes the "0x" of '#' in the "width"
specification:

https://github.com/freebsd/freebsd/blob/master/sys/kern/subr_prf.c#L894

                        p = ksprintn(nbuf, num, base, &n, upper);
                        tmp = 0;
                        if (sharpflag && num != 0) {
                                if (base == 8)
                                        tmp++;
                                else if (base == 16)
                                        tmp += 2;
                        }

That's where your two missing characters are going.

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


More information about the freebsd-bugs mailing list