Thread (25 messages) 25 messages, 6 authors, 2021-06-02

Re: [PATCH RFCv2 2/3] lib/vsprintf.c: make %pD print full path for file

From: Matthew Wilcox <willy@infradead.org>
Date: 2021-06-01 15:45:19
Also in: linux-doc, linux-fsdevel, linux-s390, linux-wireless, lkml

On Tue, Jun 01, 2021 at 06:36:41PM +0300, Andy Shevchenko wrote:
On Tue, Jun 1, 2021 at 6:32 PM Matthew Wilcox [off-list ref] wrote:
quoted
On Tue, Jun 01, 2021 at 02:42:15PM +0000, Justin He wrote:
...
quoted
Just don't put anything
in the buffer if the user didn't supply enough space.  As long as you
get the return value right, they know the string is bad (or they don't
care if the string is bad)
It might be that I'm out of context here, but printf() functionality
in the kernel (vsprintf() if being precise)  and its users consider
that it should fill buffer up to the end of whatever space is
available.
Do they though?  What use is it to specify a small buffer, print a
large filename into it and then use that buffer, knowing that it wasn't
big enough?  That would help decide whether we should print the
start or the end of the filename.

Remember, we're going for usefulness here, not abiding by the letter of
the standard under all circumstances, no matter the cost.  At least
partially because we're far outside the standard here; POSIX does
not specify what %pD does.

"The argument shall be a pointer to void. The value of the
pointer is converted to a sequence of printable characters, in an
implementation-defined manner."
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help