Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-22 Thread Johannes Schindelin
Hi, On Fri, 19 Aug 2016, Junio C Hamano wrote: > Eric Wong writes: > > > I'd be more comfortable keeping the EINVAL check that got > > snipped in your reply. O_CLOEXEC can be defined to non-zero in > > new userspace headers, but an older kernel chokes on it with > > EINVAL. >

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-19 Thread Junio C Hamano
Eric Wong writes: > I'd be more comfortable keeping the EINVAL check that got > snipped in your reply. O_CLOEXEC can be defined to non-zero in > new userspace headers, but an older kernel chokes on it with > EINVAL. Good point. Thanks. -- To unsubscribe from this list: send

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-18 Thread Johannes Schindelin
Hi Eric, On Wed, 17 Aug 2016, Eric Sunshine wrote: > On Wed, Aug 17, 2016 at 8:41 AM, Johannes Schindelin > wrote: > > When the index is locked and child processes inherit the handle to > > said lock and the parent process wants to remove the lock before the > >

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-18 Thread Johannes Schindelin
Hi Junio, On Wed, 17 Aug 2016, Junio C Hamano wrote: > But it deserves mention in the lockfile and the tempfile API docs in > and that the file descriptor returned from > these public entry points does not survive across fork(2). I touched the comments up a little bit, and I also fixed the

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-18 Thread Eric Wong
Junio C Hamano wrote: > Our codepaths themselves generally do not care about O_CLOEXEC, so > giving a racy emulation of it is not worth the effort, making the > later half of the above an overkill. OK. > Perhaps the three lines to > define O_CLOEXEC to 0 on older UNIX might

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-18 Thread Eric Wong
Johannes Schindelin wrote: > +++ b/compat/mingw.h > @@ -67,6 +67,10 @@ typedef int pid_t; > #define F_SETFD 2 > #define FD_CLOEXEC 0x1 > > +#if !defined O_CLOEXEC && defined O_NOINHERIT > +#define O_CLOEXECO_NOINHERIT > +#endif > +++ b/tempfile.c > @@ -120,7

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-18 Thread Junio C Hamano
Eric Wong writes: > O_CLOEXEC only exists since Linux 2.6.23 and there are likely > still LTS (CentOS 5.x?) and non-Linux systems which do not have > it, as well as machines with could have it defined in userspace > headers but not have it in the kernel. > > So I suggest

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-17 Thread Junio C Hamano
Johannes Schindelin writes: > From: Ben Wijen > > When the index is locked and child processes inherit the handle to > said lock and the parent process wants to remove the lock before the > child process exits, on Windows there is a problem: it won't

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-17 Thread Lars Schneider
> On 17 Aug 2016, at 14:41, Johannes Schindelin > wrote: > > From: Ben Wijen > > When the index is locked and child processes inherit the handle to > said lock and the parent process wants to remove the lock before the > child process exits, on

Re: [PATCH 2/2] mingw: ensure temporary file handles are not inherited by child processes

2016-08-17 Thread Eric Sunshine
On Wed, Aug 17, 2016 at 8:41 AM, Johannes Schindelin wrote: > When the index is locked and child processes inherit the handle to > said lock and the parent process wants to remove the lock before the > child process exits, on Windows there is a problem: it won't work >