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

Re: [PATCH v2 2/3] builtin/receive-pack.c: change xwrite to write_in_full.

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 27, 2024, 19:00 UTC
Message-ID
<xmqqwmqprav6.fsf@gitster.g>
In-Reply-To
<20240227150934.7950-3-randall.becker@nexbridge.ca>
"Randall S. Becker" <the.n.e.key@gmail.com> writes:
Show 21 quoted lines
> From: "Randall S. Becker" <rsbecker@nexbridge.com>
>
> This change is required because some platforms do not support file writes of    arbitrary sizes (e.g, NonStop). xwrite ends up truncating the output to the
> maximum single I/O size possible for the destination device.
>
> Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
> ---
>  builtin/receive-pack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index db65607485..4277c63d08 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -456,7 +456,7 @@ static void report_message(const char *prefix, const char *err, va_list params)
>  	if (use_sideband)
>  		send_sideband(1, 2, msg, sz, use_sideband);
>  	else
> -		xwrite(2, msg, sz);
> +		write_in_full(2, msg, sz);
>  }

This change does make sense, as we can see a short write(2) from xwrite() and this caller is not repeating the call to flush the remainder after a short write.

>  
>  __attribute__((format (printf, 1, 2)))
Previous: Randall S. BeckerNext: Randall S. Becker
Message 5 of 12 in “Change xwrite() to write_in_full() in builtins.”
  1. 0/2 Change xwrite() to write_in_full() in builtins.Randall S. Becker, Feb 27, 2024
  2. 1/3 builtin/repack.c: change xwrite to write_in_full and report errors.Randall S. Becker, Feb 27, 2024
  3. Junio C HamanoFeb 27, 2024
  4. 2/3 builtin/receive-pack.c: change xwrite to write_in_full.Randall S. Becker, Feb 27, 2024
  5. Junio C HamanoFeb 27, 2024
  6. 3/3 builtin/unpack-objects.c: change xwrite to write_in_full avoid truncation.Randall S. Becker, Feb 27, 2024
  7. Junio C HamanoFeb 27, 2024
  8. rsbecker@nexbridge.comFeb 27, 2024
  9. Jeff KingFeb 27, 2024
  10. rsbecker@nexbridge.comFeb 27, 2024
  11. Jeff KingMar 7, 2024
  12. rsbecker@nexbridge.comFeb 27, 2024

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.