git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] grep: make show_line more portable

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 9, 2009, 01:35 UTC
Message-ID
<7vhc23iil4.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1236561326-1231-1-git-send-email-benji@silverinsanity.com>
Brian Gernhardt <benji@silverinsanity.com> writes:
Show 6 quoted lines
> 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).

Previous: Brian GernhardtNext: Jay Soffian
Message 2 of 8 in “grep: make show_line more portable”
  1. grep: make show_line more portableBrian Gernhardt, Mar 9, 2009
  2. Junio C HamanoMar 9, 2009
  3. Jay SoffianMar 9, 2009
  4. Jay SoffianMar 9, 2009
  5. Brian GernhardtMar 9, 2009
  6. Junio C HamanoMar 9, 2009
  7. Johannes SchindelinMar 9, 2009
  8. René ScharfeMar 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.