Thread (6 messages) 6 messages, 3 authors, 2019-10-29

Re: [PATCH 1/1] vreportf(): avoid buffered write in favor of unbuffered one

From: Jeff King <hidden>
Date: 2019-10-29 14:32:48

On Tue, Oct 29, 2019 at 03:13:39PM +0100, Johannes Schindelin wrote:
quoted
I'd recommend xsnprintf() here. If we have a prefix longer than our
vreportf() buffer, I think a BUG() is the right outcome.
But BUG_fl() calls vreportf(). I am worried about an infinite
recursion...
Good point. I think it would be OK in practice (BUG() gives its own
length-limited prefix), but it's probably a good idea to err on the side
of caution inside vreportf.
quoted
I'd disagree here. Any caller sending an arbitrarily-large prefix is
holding it wrong, and we'd probably want to know as soon as possible
(and a BUG() is our best bet there).
How about truncating already inside the prefix, then? It would miss the
entire error message... but at least it would print _something_...
Yeah, that might be OK. Hopefully missing the whole rest of the error
message would cause some tests to fail.

You could also abort() after having written if we want to be more
BUG()-like.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help