On 6/3/22 11:18 AM, Namikaze Minato wrote:

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:
   Output redirections to variable file descriptors inside functions
lead to incorrect representation (declare -f). Breaking exported
functions.
   Reproductible with all bash versions from version 4.2 to latest
version including beta.
   Reproductbile on all all platforms.

Repeat-By:
   $ f(){ foo=1; printf test\\n >&"$foo"; }; declare -f f

Thanks for the report. This is, as you've pointed out, ambiguous until the
shell function is executed and `foo' is expanded. It's better for the
command printing code not to try to guess about how it will eventually be
translated when executed. I'll put in something to that effect, after
changing the code that caused this 2004 change.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to