bug-bash
[Top][All Lists]
Advanced

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

Re: integer variable that unsets itself causes segfault


From: Chet Ramey
Subject: Re: integer variable that unsets itself causes segfault
Date: Wed, 3 Sep 2025 16:05:05 -0400
User-agent: Mozilla Thunderbird

On 9/1/25 2:14 PM, Chet Ramey wrote:
On 8/30/25 12:22 PM, Zachary Santer wrote:
On Sat, Aug 30, 2025 at 11:41 AM Chet Ramey <chet.ramey@case.edu> wrote:

It occurs to me that bash should print a warning when you attempt something
like this:

declare -n foo=bar
declare -i foo

since bash disallows that now by ignoring the attempt to add the integer
attribute

The manual explicitly lays this out as something you can do:

Sorry, you're right. This indeed changes the attributes on the target variable, if you're applying it to an already-declared nameref. It's trying to give thenameref variable itself the integer attribute that is the problem.

So the question is now whether to disallow `declare -in foo' (or
`declare -in foo=bar') and make it a usage error, print a warning that
it will be ineffective, or simply let it be ineffective, as it is now.


--
``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]