[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: parameter expansion assignment to array index nameref
From:       Chet Ramey <chet.ramey () case ! edu>
Date:       2023-04-10 20:10:52
Message-ID: 387d12c4-6976-3d40-4d95-11c95f63cfff () case ! edu
[Download RAW message or body]

On 4/6/23 4:20 PM, Grisha Levit wrote:
> $ declare -n ref=arr[1]
> $ arr=(A); (echo "${ref=X} ${ref}")
> A X
> $ arr=( ); (echo "${ref=X} ${ref}")
> Segmentation fault: 11
> 
> Expanding the nameref while still in parameter_brace_expand seems to do the
> right thing though I can't say I'm fully confident in this.

Thanks for the report. The problem is the `=' operator and the (new) POSIX
semantics requiring the expansion to return "the final value of parameter,"
after any transformations get applied (e.g., uppercase, lowercase,
arithmetic evaluation). It makes sense to fix it there.

Chet
-- 
``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/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic