bug-bash
[Top][All Lists]
Advanced

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

Re: It is possible to remove the readonly attribute from {BASH, SHELL}OP


From: Grisha Levit
Subject: Re: It is possible to remove the readonly attribute from {BASH, SHELL}OPTS
Date: Tue, 13 Feb 2024 12:41:11 -0500

On Wed, Jan 31, 2024, 14:10 Chet Ramey <chet.ramey@case.edu> wrote:

> Well, is this a "my arm hurts when I do this" problem, or should bash
> restrict the types of attributes that can be set on readonly variables?
>

For the attributes that only affect future assignments ([iluc]), I think
think it makes sense to either (a) restrict the ability to change these
attributes on readonly variables or (b) make internal assignments that
force new values on readonly variables ignore such attributes.

Option (a) makes the behavior more transparent to the user, but I can't say
if the added complexity is worth it. My ASS_NOEVAL patch was meant as an
attempt at option (b).

If code were to be added to restrict adding the above attributes, then
restricting [aA] might make sense too. While converting a readonly scalar
variable to an array does have a user-visible consequence -- an exported
scalar variable is no longer present in the environment after being
converted to an array -- one can already toggle the export attribute of
readonly variables.

This leaves the trace attribute, which doesn't do anything for variables,
but I've occasionally found it useful for debugging Bash issues so would
put in a weak vote to not restrict its modification.

>


reply via email to

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