Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] grep: make show_line more portable

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:21

Brian Gernhardt [off-list ref] writes:
On OS X the printf specifier "%.0s" outputs the entire string instead
of 0 characters as POSIX states.

In addition, for * width or precision printf expects an integer
argument.  On systems were regoff_t is 64-bit, unexpected results can
occur.
I would prefer to see these two issues solved as separate issues.

Specifically, I'd like to know if the patch from me to you a few message
ago solves the issue.

If you still need a "some implementations of printf is broken with respect
to 0 precision" workaround on top of that patch, we would want to add it
separately, but it may have to cover not just this printf(), as I am not
convinced this is the only place that lets (integer) 0 passed to the
"%.*s" format.  That patch needs to be written after a separate auditing
of output from "git grep -n -e 'printf.*%\.\*s'", which I do not think
happened yet (at least I haven't done that, and I somehow do not think you
have yet either).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help