Hi Lars,

On Wed, 10 Aug 2016, larsxschnei...@gmail.com wrote:

> From: Lars Schneider <larsxschnei...@gmail.com>
> Consider the case of a file that requires filtering and is present in branch A
> but not in branch B. If A is the current HEAD and we checkout B then the
> following happens:
> 1. ce_compare_data() opens the file
> 2.   index_fd() detects that the file requires to run a clean filter and
>      calls index_stream_convert_blob()
> 4.     index_stream_convert_blob() calls convert_to_git_filter_fd()
> 5.       convert_to_git_filter_fd() calls apply_filter() which creates a new
>          long running filter process (in case it is the first file of this 
> kind
>          to be filtered)
> 6.       The new filter process inherits all file handles. This is the default
>          on Linux/OSX and is explicitly defined in the `CreateProcessW` call
>          in `mingw.c` on Windows.
> 7. ce_compare_data() closes the file
> 8. Git unlinks the file as it is not present in B
> The unlink operation does not work on Windows because the filter process has
> still an open handle to the file. Apparently that is no problem on Linux/OSX.
> Probably because "[...] the two file descriptors share open file status flags"
> (see fork(2)).

We typically wrap the commit messages at 76 columns per row (personally,
I wrap already at 72, and it seems Junio wraps at 70).

> Fix this problem by opening files in read-cache with the `O_CLOEXEC` flag to
> ensure that the file descriptor does not remain open in a newly spawned 
> process.
> `O_CLOEXEX` is defined as `O_NOINHERIT` on Windows. A similar fix for 
> temporary


> file handles was applied on Git for Windows already:
> https://github.com/git-for-windows/git/commit/667b8b51ec850c3e1c7d75dee69dc13c29d1f162

In response to your commit note on GitHub, I submitted this patch series
(slightly cleaned up) yesterday (and you already commented on it):


The patch is obviously correct, and needs the patch series I submitted to
compile on Windows (this note is more for Junio's interest than a comment
on this patch).

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to