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

Re: [PATCH 0/4] On Windows, limit which file handles are inherited by spawned child processes

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 25, 2019, 16:29 UTC
Message-ID
<nycvar.QRO.7.76.6.1911251727560.31080@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqimn8y0k5.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Mon, 25 Nov 2019, Junio C Hamano wrote:
Show 13 quoted lines
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > The problem to be solved: files cannot be deleted on Windows when even one
> > process has an open file handle to it. So when a process opens a temporary
> > file, then spawns a child process that inherits that file handle by mistake,
> > and then the parent process tries to delete the temporary file while the
> > child process is still running, the deletion will fail. (This description is
> > slightly simplified, see the commit message "spawned processes need to
> > inherit only standard handles" for more detail.)
>
> Makes me wonder if we should be marking these fds with FD_CLOEXEC to
> solve the issue in a way that is platform agnostic.
I would like that a lot.

Having said that, it is too easy to miss when a patch forgets to do that and when the contributor only tests on Linux. So I really also would like to keep the current patch in addition.

Thanks, Dscho

Show 9 quoted lines
> It may turn out that we'd be better off to make it an explicit choice by
> the parent when it leaves a FD open while spawning a child process (and
> by that spawned child when it runs another executable---but I undertand
> that it is a single-step operation, not a two-step one, on Windows).
>
> In any case, synchronizing the differences in compat/ between our
> trees is good.  Queued.
>
>
Previous: Junio C Hamano
Message 13 of 13 in “On Windows, limit which file handles are inherited by spawned child processes”
  1. 0/4 On Windows, limit which file handles are inherited by spawned child processesJohannes Schindelin via GitGitGadget, Nov 22, 2019
  2. 2/4 mingw: work around incorrect standard handlesJohannes Schindelin via GitGitGadget, Nov 22, 2019
  3. 1/4 mingw: demonstrate that all file handles are inherited by child processesJohannes Schindelin via GitGitGadget, Nov 22, 2019
  4. 4/4 mingw: restrict file handle inheritance only on Windows 7 and laterJohannes Schindelin via GitGitGadget, Nov 22, 2019
  5. 3/4 mingw: spawned processes need to inherit only standard handlesJohannes Schindelin via GitGitGadget, Nov 22, 2019
  6. Johannes SixtNov 28, 2019
  7. Johannes SchindelinNov 29, 2019
  8. Johannes SchindelinNov 29, 2019
  9. Johannes SixtNov 29, 2019
  10. Johannes SixtNov 29, 2019
  11. Johannes SchindelinNov 30, 2019
  12. Junio C HamanoNov 25, 2019
  13. Johannes SchindelinNov 25, 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.