bug-bash
[Top][All Lists]
Advanced

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

local -[aA] on dangling nameref


From: Grisha Levit
Subject: local -[aA] on dangling nameref
Date: Wed, 15 Oct 2025 12:19:51 -0400

While a compound assignment to a dangling nameref removes the
nameref attribute:

    $ f() { local -n x; x=(); local -p; }; f
    bash: warning: x: removing nameref attribute
    declare -a x=()

the same does not happen when using `local' to perform compound
assignment or to set the array or assoc attribute on a dangling
nameref:

    f() {
        local -n x; local -p
        local -A x; local -p
        local x=(); local -p
        local x=(y)
    }; (f)

    declare -n x
    declare -An x
    declare -aAn x=()
    Segmentation fault     ( f )



reply via email to

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