Re: integer variable that unsets itself causes segfault
From:
Martin D Kealey
Subject:
Re: integer variable that unsets itself causes segfault
Date:
Sun, 24 Aug 2025 13:40:23 +1000
On Wed, 20 Aug 2025 at 00:15, Chet Ramey <chet.ramey@case.edu> wrote:
> No different than evaluating a variable value in an expression as an
> expression.
>
In other languages, binding and assignment are clearly different
operations, where this would clearly NOT be "no different". (Such
malapropisms are, sadly, an oft recurring theme in the design of the shell
language; *sigh*.)
> I would rather that assignment modifier flags (-i, -l, -u, -r} simply be
> > ignored when binding.
>
> I'm sure you would, but that's neither backwards compatible nor compatible
> with other shells (ksh93, mksh, even zsh) that impletment declare/typeset.
In respect of -l, -u and -r, that's fair comment, so let's set those aside
and focus on binding with -i, where the old behaviour was to fail silently.
Ignoring -i when binding (only applying it when assigning) would seem like
a reasonable backwards-compatible extension, but can anyone think of a
circumstance where failing to leave the name unbound, and/or failing to
return a non-zero exit status, could conceivably break something useful?
-Martin