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

From: Laurent Bercot <>
Date: Sun, 10 May 2015 00:27:15 +0200

On 10/05/2015 00:07, Guillermo wrote:
> 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? :)

  Know that I precisely audited the whole series of programs running
with 0, 1 and 2 closed in those stages before answering you. And
there's no risk there, it works. :)
  (In stage 3, you can replace "fdclose 0" with "redirfd -r 0 /dev/null"
and it will be conformant. No such easy way out in stage 1, though,
if you want to change /dev after the kernel has mounted it. Note that
you don't have to do that if you're using devtmpfs and keeping it.)

> 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...

  Did you really manage to umount /dev (maybe) and mount a tmpfs
over it (for sure) with fds still open to the old /dev ? Without
an EBUSY error ? If it's the case, and you're using Linux, then the
kernel's behaviour changed.

Received on Sat May 09 2015 - 22:27:15 UTC

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