[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn 1.3.0: post-commit hook waits even if tasks are backgrounded

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2006-01-17 21:57:03 CET

Greg Hudson <ghudson@MIT.EDU> writes:

> On Tue, 2006-01-17 at 14:41 +0100, Peter N. Lundblad wrote:
>> Seriously, the problem is that apr pipes are inherited by child processes
>> by default (at least on Unix). I don't know if this is a bug; I'll ask on
>> the APR list.
>
>> The problem this causes is that the write end of our pipe we create for
>> stderr will be open twice in the child process (one for stderr and then
>> another descriptor that was the original descriptor created for the pipe).
>
> That doesn't match my reading of the APR code. From apr_proc_create():
>
> if (attr->child_err) {
> apr_file_close(attr->parent_err);
> dup2(attr->child_err->filedes, STDERR_FILENO);
> apr_file_close(attr->child_err);
> }

Subversion's run_hook_cmd() creates the pipe and then passes one end
to svn_io_start_cmd() where it gets passed to
apr_procattr_child_err_set() where it gets used as an argument to
apr_file_dup2(). The dup2 creates a duplicate file descriptor, so
there are two descriptors open before the fork() and the code shown
above only addresses one of them.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jan 18 00:18:46 2006

This is an archived mail posted to the Subversion Dev mailing list.