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

Re: [PATCH] Clear fd after closing to avoid double-close error

From
Jens Lindström <jl@opera.com>
Date
Oct 23, 2013, 07:52 UTC
Message-ID
<CAEef6Wyui5EkNoEGKfb+NHZyb3BTkHME234M1zMyjuux5yMUeg@mail.gmail.com>
In-Reply-To
<xmqq8uxltaeh.fsf@gitster.dls.corp.google.com>
On Tue, Oct 22, 2013 at 8:42 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
Show 6 quoted lines
>> Life would have been simpler if fd[1] was _always_ closed by
>> send_pack(), like in c20181e (start_command(), if .in/.out > 0, closes
>> file descriptors, not the callers - 2008-02-21).
>
> Yeah, that was also my first reaction when I saw the above three
> lines after reading the discussion that led to the diagnosis.

If send_pack() always closes fd[1], then I believe "git send-pack --stateless-rpc --helper-status" would die in print_helper_status(), called after send_pack(), since fd[1] would be 1, to which print_helper_status() will try to write. (I don't know what either --stateless-rpc or --helper-status mean, other than what's obvious from the code, or if the combination of them makes any sense.)

I don't really have any more time to spend on this issue, so if a more thorough fix is required, I'm afraid someone else will have to work on it.

/ Jens
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “Clear fd after closing to avoid double-close error”
  1. Clear fd after closing to avoid double-close errorJens Lindström, Oct 22, 2013
  2. Duy NguyenOct 22, 2013
  3. Jens LindströmOct 22, 2013
  4. Junio C HamanoOct 22, 2013
  5. Jens LindströmOct 23, 2013
  6. Junio C HamanoOct 23, 2013

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.