bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: >&"$var" broken in declare -f and exported functions


From: Chet Ramey
Subject: Re: >&"$var" broken in declare -f and exported functions
Date: Mon, 6 Jun 2022 10:33:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0

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    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]