On Fri, Mar 13, 2020 at 17:09:14 -0700, Paul Goyette wrote: > On Sat, 14 Mar 2020, Valery Ushakov wrote: > > > On Fri, Mar 13, 2020 at 14:17:42 -0400, Christos Zoulas wrote: > > > > > Log Message: > > > PR/55068: sc.dying: Fix printf formats: > > [...] > > > - 0x% -> %# > > > > This was not a part of the PR and is completely cosmetic (surely it > > supports plain %x if it does support %#x). Why was this necessary? > > (I know I would be quite miffed if someone made a change like that to > > my code). > > Plain %x - no :( > > In order to enable sysctl-transport to userland, all the args need to > be promoted to %jx, and the format strings need to ensure that they > consume that size.
Random sample from the diff: - printf("%s: expect 0xe6!! (0x%x)\n", device_xname(sc->sc_dev), + printf("%s: expect 0xe6!! (%#x)\n", device_xname(sc->sc_dev), Actually, looking close I see diffs like - DPRINTFN(MD_ROOT, "wValue=0x%04jx", value, 0, 0, 0); + DPRINTFN(MD_ROOT, "wValue=%#04jx", value, 0, 0, 0); that are plain wrong as %#x counts the 0x prefix towards the field width. $ printf '0x%02x %#02x\n' 1 1 0x01 0x1 $ printf '0x%08x 0x%08x\n%#08x %#08x\n' 0 1 0 1 0x00000000 0x00000001 00000000 0x000001 So, as far as I can tell, these %# changes don't fix all the argument size issues, break some output formatting and violate preference of the original author. Did I miss something else? -uwe