|
From: | Jim Avera |
Subject: | Re: Fixing coproc race condition bug |
Date: | Sun, 24 Oct 2021 13:54:20 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
On 10/24/21 1:44 PM, Jim Avera wrote:
# Note: Ignore errors when closing pipes, as the user might have manually closed # the fds using 'exec {varname}>&-' or similar.
Actually this isn't a good idea because the fd might have been re-used for something else; so an error should be reported to make that bug-condition noticeable so it can be fixed.
Instead, bash should search all active CPROC variables for any file descriptors being closed explicitly, and undef the corresponding COPROC slot; that will prevent bash from calling close() on a previously-closed file descriptor.
-Jim
[Prev in Thread] | Current Thread | [Next in Thread] |