[PATCH] ash: add process substitution in bash-compatibility mode

Denys Vlasenko vda.linux at googlemail.com
Thu Jan 24 14:15:56 UTC 2019


On Fri, Nov 23, 2018 at 2:10 PM Ron Yorston <rmy at pobox.com> wrote:
>
> Process substitution is a Korn shell feature that's also available
> in bash and some other shells.  This patch implements process
> substitution in ash when ASH_BASH_COMPAT is enabled.

> +#if BASH_PROCESS_SUBST
> +       /* If we don't close new fds here
> +        *   f() { while true; do cat <(echo hi); done }
> +        *   f
> +        * runs out of file descriptors.
> +        */
> +       if (level != 0) {
> +               close_new_fds(level);
> +               pslevel = old_level;
> +       }
> +#endif

> +#if BASH_PROCESS_SUBST
> +       /* Only close fds if we aren't in a shell function.  If we don't
> +        * close fds here
> +        *    while true; do cat <(echo hi); done
> +        * runs out of file descriptors.
> +        */
> +       if (funcline == 0)
> +               close_all_fds();
> +#endif

Can we use popredir() mechanism instead?


More information about the busybox mailing list