Re: [PATCH 0/4] On Windows, limit which file handles are inherited by spawned child processes
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 25, 2019, 05:42 UTC
- Message-ID
- <xmqqimn8y0k5.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <pull.670.git.git.1574433665.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 7 quoted lines
> 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. 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.