On 01/06/2021 19.05, Matthew Wilcox wrote: > Here's some examples, what do you think makes sense? > > snprintf(buf, 16, "bad file '%pD'\n", q); > > what content do you want buf to have when q is variously: > > 1. /abcd/efgh > 2. /a/bcdefgh.iso > 3. /abcdef/gh > > I would argue that > "bad file ''\n" > is actually a better string to have than any of (case 2) > "bad file '/a/bc" > "bad file 'bcdef" > "bad file 'h.iso" > Whatever ends up being decided, _please_ document that in machine-readable and -verifiable form. I.e., update lib/test_printf.c accordingly. Currently (and originally) it only tests %pd because %pD is/was essentially just %pd with an indirection to get the struct dentry* from a struct file*. The existing framework is strongly centered around expecting '/a/bc (see all the logic where we do multiple checks with size 0, size random, size plenty, and for the random case check that the buffer contents match the complete output up till the randomly chosen size), so adding tests for some other semantics would require a bit more juggling. Not that that should be an argument in favor of that behaviour. But FWIW that would be my preference. Rasmus