This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/3] posix: Use posix_spawn on popen
On Tue, Sep 18, 2018 at 02:01:29PM -0400, Zack Weinberg wrote:
> On Sun, Sep 16, 2018 at 1:13 AM David Newall <glibc@davidnewall.com> wrote:
> > It seems to me that there are still reasonable questions about whether
> > to use posix_spawn or vfork ("posix_spawn is a badly designed API").
>
> When I said to Sergey that I would rather see the problem they
> reported addressed using vfork instead of posix_spawn, I was giving
> advice to a new contributor. I really _would_ rather see it addressed
> that way, and I also thought that they were more likely to succeed in
> writing those patches.
>
> Adhemerval is not a new contributor and they deeply understand the
> problems in this area. Their patches strike me as a step generally in
> the right direction. I don't have time to review them in detail, but
> I don't object to them. However, do I think some of the fine details
> demonstrate why an API that allows for arbitrary computation and
> system calls before exec would be preferable, such as there being "no
> safe way to clear close-on-exec in the child" (because, IIUC, there's
> no posix_spawn action to do that).
The resolution to Austin Group issue #411 made it so adddup2(n,n) does
what you want:
http://austingroupbugs.net/view.php?id=411
Rich