coprocs some more

Zachary Santer <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <CABkLJULYG6d7LKCoSe4kE1-hFC+NS0x0ic8TYhp+QVixrvqkTw@mail.gmail.com>
From "printf -u "$fd"?":
On Tue, May 21, 2024 at 3:06 PM Chet Ramey <[email protected]> wrote:
>
> On 5/21/24 11:14 AM, Zachary Santer wrote:
> > On Tue, May 21, 2024 at 9:01 AM Chet Ramey <[email protected]> wrote:
> >>
> >> On 5/21/24 6:17 AM, Zachary Santer wrote:
> >>>
> >>> I saw that you turned MULTIPLE_COPROCS=1 on by default
> >>> under devel, but haven't touched the somewhat more substantial changes
> >>> that sounded forthcoming, from that whole conversation.
> >>
> >> Which one is that?
> >
> > So this email[1] was just about the config-top.h change, I guess, but
> > in the prior one from you quoted there[2], you seemed to be
> > referencing only removing the coproc once both file descriptors
> > pointing to it have been closed by the user.
>
> I haven't committed to doing anything with how coprocs are reaped, and if I
> do it will certainly not be before bash-5.3.

Don't know if anyone is down to have this conversation again, but the
devel branch is getting changes for bash-5.4 now.

From "Examples of concurrent coproc usage?":
On Tue, Jun 11, 2024 at 8:11 AM Zachary Santer <[email protected]> wrote:
>
> On Mon, Jun 10, 2024 at 1:07 PM Robert Elz <[email protected]> wrote:
> >
> > The next POSIX will include O_CLOFORK and FD_CLOFORK (or names
> > similar to those) for open (etc) and fcntl(FDFLAGS)) - that is
> > analogs of O_CLOEXEC and FD_CLOEXEC but applying to fork() rather
> > than exec*().
>
> Well there you go. Once people are satisfied with the extent to which
> O_CLOFORK and FD_CLOFORK are present in operating systems, the coproc
> keyword could simply apply that fd flag to the fds it creates. A
> builtin 'fdflags' or similar could then turn it off for those fds or
> on for any arbitrary fd.

Looks like that "next POSIX" was literally published a few days after
this email exchange.

<fcntl.h>
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fcntl.h.html

1003.1-2024 - IEEE/Open Group Standard for Information
Technology--Portable Operating System Interface (POSIX™) Base
Specifications, Issue 8 | IEEE Standard | IEEE Xplore
https://ieeexplore.ieee.org/document/10555529
> Date of Publication: 14 June 2024

All of bash's internal machinery to keep FDs out of child processes
could potentially be replaced by simply assigning FD_CLOFORK to those
FDs.

Zack
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.