[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coproc FDs (file descriptors) available to subshells
From: |
Tadeus Prastowo |
Subject: |
Re: coproc FDs (file descriptors) available to subshells |
Date: |
Wed, 24 Jan 2018 19:32:26 +0100 |
On Wed, Jan 24, 2018 at 5:51 PM, Tadeus Prastowo
<tadeus.prastowo@unitn.it> wrote:
> On Wed, Jan 24, 2018 at 3:55 PM, Tadeus Prastowo
> <tadeus.prastowo@unitn.it> wrote:
>> On Wed, Jan 24, 2018 at 3:53 PM, Chet Ramey <chet.ramey@case.edu> wrote:
>>> On 1/24/18 9:50 AM, Tadeus Prastowo wrote:
>>>> On Wed, Jan 24, 2018 at 3:16 PM, Chet Ramey <chet.ramey@case.edu> wrote:
>>>>> On 1/24/18 3:38 AM, Tadeus Prastowo wrote:
>>>>>> Hi!
>>>>>>
>>>>>> To quote
>>>>>> https://www.gnu.org/software/bash/manual/html_node/Coprocesses.html#Coprocesses
>>>>>>
>>>>>> "The file descriptors are not available in subshells."
>>>>>
>>>>> The file descriptors are set to close-on-exec, so they're not available
>>>>> to new processes, and closed explicitly when executing subshell commands
>>>>> such as ( ... ) and asynchronous commands run with `&'. Command and
>>>>> process substitutions are created as exact copies of their parent, and
>>>>> inherit the file descriptors.
>>>>
>>>> So, the documentation should be fixed, no?
>>>
>>> Sure, it can be clarified.
>>
>> Okay, I will propose a patch.
>
> diff --git a/doc/bashref.texi b/doc/bashref.texi
> index c0f4a2f..fee8f0e 100644
> --- a/doc/bashref.texi
> +++ b/doc/bashref.texi
> @@ -1197,7 +1197,10 @@ This pipe is established before any
> redirections specified by the
> command (@pxref{Redirections}).
> The file descriptors can be utilized as arguments to shell commands
> and redirections using standard word expansions.
> -The file descriptors are not available in subshells.
> +The file descriptors are not available in subshells other than those
> +created by command and process substitutions (see the descriptions
> +the substitutions in @ref{Command Substitution} and
> +@ref{Process Substitution}, respectively).
>
> The process ID of the shell spawned to execute the coprocess is
> available as the value of the variable @env{NAME}_PID.
> @@ -3025,6 +3028,12 @@ shell's parent, and traps ignored by the shell
> are ignored
> A command invoked in this separate environment cannot affect the
> shell's execution environment.
>
> +Command substitution and process substitution are invoked in a
> +separate execution environment that starts as an exact duplicate of
> +the execution environment of the shell. As before, any command within
> +the separate execution environment cannot affect the shell's execution
> +environment.
> +
> Command substitution, commands grouped with parentheses,
> and asynchronous commands are invoked in a
> subshell environment that is a duplicate of the shell environment,
I think the patch misses some information. Please find attached the
new patch that I propose. What do you think?
Thanks.
--
Best regards,
Tadeus
patch
Description: Binary data
- coproc FDs (file descriptors) available to subshells, Tadeus Prastowo, 2018/01/24
- Re: coproc FDs (file descriptors) available to subshells, Chet Ramey, 2018/01/24
- Re: coproc FDs (file descriptors) available to subshells, Tadeus Prastowo, 2018/01/24
- Re: coproc FDs (file descriptors) available to subshells, Chet Ramey, 2018/01/24
- Message not available
- Re: coproc FDs (file descriptors) available to subshells, Tadeus Prastowo, 2018/01/24
- Re: coproc FDs (file descriptors) available to subshells,
Tadeus Prastowo <=
- Re: coproc FDs (file descriptors) available to subshells, Tadeus Prastowo, 2018/01/24
- Fwd: coproc FDs (file descriptors) available to subshells, Tadeus Prastowo, 2018/01/26
- Message not available
- Re: Fwd: coproc FDs (file descriptors) available to subshells, Tadeus Prastowo, 2018/01/26