[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: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2006-01-17 20:33:55 CET

On Tue, 17 Jan 2006, Greg Hudson wrote:

> 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);
> }
>

Yeah, you're not the first one to get confused. But go read
apr_procattr_childerr_set. This function creates a new pipe, allocating
file descriptors for its own use and then dup2s the descriptor(s) we gave
it. The allocated descriptors will be closed after having been duplicated
to stderr, but the descriptor we gave it will not be closed.

Hope this clarifies,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jan 17 23:11:47 2006

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