Closing the file descriptor like this may result in the shell failing
to process the entire script, and I haven't seen documented evidence
to the contrary
On Sat, Feb 5, 2011 at 10:45 PM, AmenophisIII <email address hidden> wrote:
> hm seems it is still not in scott's bazaar repo:
> http://bazaar.launchpad.net/~canonical-scott/upstart/trunk/view/head:/init/job_process.c#L317
> why?
>
> redhat fixed it exactly as suggested above
> (https://bugzilla.redhat.com/attachment.cgi?id=455799&action=edit)
>
> --
> You received this bug notification because you are a member of Upstart
> Developers, which is subscribed to upstart .
> https://bugs.launchpad.net/bugs/619269
>
> Title:
> init: "script" stanza leaks file descriptor to child process
>
> Status in Upstart:
> Triaged
>
> Bug description:
> Upstart sends job scripts to shell via pipe represented by
> /dev/fd/<fd> (/proc/self/fd/) file in proc filesystem, e.g.:
>
> /bin/sh -e /dev/fd/9
>
> This fd stays open while child shell process is running. There are
> some applications like pvdisplay (and other lvm2 tools) which
> complaint about it.
>
> How to reproduce:
>
> Boot to runlevel 1
> Run pvdisplay:
>
> # pvdisplay
> File descriptor 9 (pipe:[9737]) leaked on pvdisplay invocation. Parent PID 845: /bin/bash
> --- Physical volume ---
> ...
>
> Possible solution would be send first closing pipe fd command to
> shell:
>
> + close_fd = NIH_MUST (nih_sprintf (NULL, "<&%d- ;", fds[0]));
> + NIH_ZERO (nih_io_write (io, close_fd, strlen (close_fd)));
> +
> NIH_ZERO (nih_io_write (io, script, strlen (script)));
> nih_io_shutdown (io);
>
>
>
Because I'm not convinced this works.
Closing the file descriptor like this may result in the shell failing
to process the entire script, and I haven't seen documented evidence
to the contrary
On Sat, Feb 5, 2011 at 10:45 PM, AmenophisIII <email address hidden> wrote: bazaar. launchpad. net/~canonical- scott/upstart/ trunk/view/ head:/init/ job_process. c#L317 /bugzilla. redhat. com/attachment. cgi?id= 455799& action= edit) /bugs.launchpad .net/bugs/ 619269
> hm seems it is still not in scott's bazaar repo:
> http://
> why?
>
> redhat fixed it exactly as suggested above
> (https:/
>
> --
> You received this bug notification because you are a member of Upstart
> Developers, which is subscribed to upstart .
> https:/
>
> Title:
> init: "script" stanza leaks file descriptor to child process
>
> Status in Upstart:
> Triaged
>
> Bug description:
> Upstart sends job scripts to shell via pipe represented by
> /dev/fd/<fd> (/proc/self/fd/) file in proc filesystem, e.g.:
>
> /bin/sh -e /dev/fd/9
>
> This fd stays open while child shell process is running. There are
> some applications like pvdisplay (and other lvm2 tools) which
> complaint about it.
>
> How to reproduce:
>
> Boot to runlevel 1
> Run pvdisplay:
>
> # pvdisplay
> File descriptor 9 (pipe:[9737]) leaked on pvdisplay invocation. Parent PID 845: /bin/bash
> --- Physical volume ---
> ...
>
> Possible solution would be send first closing pipe fd command to
> shell:
>
> + close_fd = NIH_MUST (nih_sprintf (NULL, "<&%d- ;", fds[0]));
> + NIH_ZERO (nih_io_write (io, close_fd, strlen (close_fd)));
> +
> NIH_ZERO (nih_io_write (io, script, strlen (script)));
> nih_io_shutdown (io);
>
>
>