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

Re: [PATCH 1/2] dup() the input fd for fast-import used for remote helpers

From
Jeff King <peff@peff.net>
Date
May 16, 2019, 03:28 UTC
Message-ID
<20190516032838.GC4596@sigill.intra.peff.net>
In-Reply-To
<20190516003736.25544-1-mh@glandium.org>
On Thu, May 16, 2019 at 09:37:35AM +0900, Mike Hommey wrote:
Show 14 quoted lines
> When a remote helper exposes the "import" capability, stdout of the
> helper is sent to stdin of a new fast-import process. This is done by
> setting the corresponding child_process's in field to the value of the
> out field of the helper child_process.
> 
> The child_process API is defined to close the file descriptors it's
> given when calling start_command. This means when start_command is
> called for the fast-import process, its input fd (the output fd of the
> helper), is closed.
> 
> But when the transport helper is later destroyed, in disconnect_helper,
> its input and output are closed, which means close() is called with
> an invalid fd (since it was already closed as per above). Or worse, with
> a valid fd owned by something else (since fd numbers can be reused).
I think this strategy is OK, as explained in my other email.
-Peff
Previous: Jeff King
Message 5 of 5 in “Re: Closing fds twice when using remote helpers”
  1. Mike HommeyMay 16, 2019
  2. 1/2 dup() the input fd for fast-import used for remote helpersMike Hommey, May 16, 2019
  3. 2/2 Use xmmap_gently instead of xmmap in use_packMike Hommey, May 16, 2019
  4. Jeff KingMay 16, 2019
  5. Jeff KingMay 16, 2019

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.