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

RE: [Possible Bug] Use of write on size-limited platforms

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Jun 19, 2020, 15:05 UTC
Message-ID
<028c01d6464b$235346c0$69f9d440$@nexbridge.com>
In-Reply-To
<20200616080200.GA650578@coredump.intra.peff.net>
On June 16, 2020 4:02 AM, Peff wrote:
Show 23 quoted lines
> To: Randall S. Becker <rsbecker@nexbridge.com>
> Cc: git@vger.kernel.org
> Subject: Re: [Possible Bug] Use of write on size-limited platforms
> 
> On Mon, Jun 15, 2020 at 06:38:34PM -0400, Randall S. Becker wrote:
> 
> > > So I think this really ought to be using write_in_full(). There's
> > > only one caller, and I think it would be improved by the switch. Do
> > > you want to write a patch?
> > >
> > > You could make an argument that the fwrite() version ought to also
> > > loop, since it's possible to get a partial write there, too. But we
> > > don't do that in general. I suspect in practice most stdio
> > > implementations will keep writing until they see an error, and most
> > > callers don't bother checking stdio errors at all, or use ferror().
> >
> > I'll give the patch a go. It is very simple. Would you suggest
> > removing the strbuf_write_fd() as part of this patch since it only
> > impacts bugreport.c?
> 
> I could go either way on that. IMHO it isn't offering much over a bare
> write_in_full() call. The "don't call write() if there are 0 bytes"
> logic is part of write_in_full() already.
Patch delivered.

Regards, Randall

Previous: Jeff KingNext: Junio C Hamano
Message 5 of 6 in “[Possible Bug] Use of write on size-limited platforms”
  1. Randall S. BeckerJun 8, 2020
  2. Jeff KingJun 15, 2020
  3. Randall S. BeckerJun 15, 2020
  4. Jeff KingJun 16, 2020
  5. Randall S. BeckerJun 19, 2020
  6. Junio C HamanoJun 19, 2020

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.