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

Re: [PATCH] rev-list: handle %x00 NUL in user format

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 13, 2010, 21:58 UTC
Message-ID
<7vtykpiwkv.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20101007182542.GA20165@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Erik mentioned a potential problem with fwrite() and the way we handle
> ANSI emulation for Windows. I think if there is a problem, then the same
> problem exists in the --graph code, and we should do this, and then fix
> both on top.

I am quite sure that --graph codepath is used a lot less often than this codepath, and most users do not hit the problem you are fixing---that is why it took so long to get noticed. I think this printf() has been there from the beginning, even though the possibility of placing a NUL in buf.buf may have come much later, like when %x00 was introduced).

Use of fwrite() here will affect all Windows users who use color (probably most of them), no? It may be a deliberate regression, but it has a real cost associated with it; it will break more usual uses on Windows to help an obscure use case on POSIX.

As to emulating fwrite(3) on Windows, even though there are a lot of callers of fwrite(3) that do not want the payload colored, it is probably sufficient to check isatty(fileno(stream)) upfront like all the other winansi_fEMULATED() functions do, and to make ansi_emulate() call the system fwrite(3) directly.

I'll queue this patch on a side branch and I may even feel like merging it to 'next', but we would need to hear from Windows folks how they want to proceed soon.

Previous: Jeff KingNext: Jeff King
Message 2 of 3 in “rev-list: handle %x00 NUL in user format”
  1. rev-list: handle %x00 NUL in user formatJeff King, Oct 7, 2010
  2. Junio C HamanoOct 13, 2010
  3. Jeff KingOct 14, 2010

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.