Re: execline's pipeline (and forbacktickx) with closed stdin

From: Guillermo <gdiazhartusch_at_gmail.com>
Date: Sat, 9 May 2015 19:07:34 -0300

Laurent Bercot wrote:
>
> So I've pushed a fix to the current execline
> git, please tell me if it works for you.

Yes, that worked.

> However, POSIX considers that UB is acceptable when you run a
> program with 0, 1 or 2 closed: look for "If file descriptor 0" in
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.HTML

Ah, I see.

> I'll try to support the case as much as I can, and squash those bugs
> whenever they're found, but still, don't do that - Big Bad POSIX will
> bite you if you do.

Let's narrow the scope:

> I consider it a bug, because there are cases where I do need to
> run programs with fds 0, 1 or 2 closed, and I generally try to
> pay attention to this.

I ran into this while experimenting with the example / template stage
1 and 3 init scripts that come with s6's source code. Both of them do
an early fdclose 0 to ignore input. Wouldn't that be tempting the
demons to fly through your nose, then? :)

Anyway, I had either replaced the early fdclose 0 with redirfd -r 0
/dev/null (and also realized that worked by accident, because I
somehow have a nonempty /dev at startup) or delayed it a bit. I
suppose that's good enough...

Thanks,
G.
Received on Sat May 09 2015 - 22:07:34 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC