On Mon, May 2, 2016 at 2:30 PM, Chet Ramey <[email protected]> wrote:
I ended up writing a new function: valid_nameref_value(name, flags) which
> I can customize to serve this purpose.
>
Looks like this ends up getting bypassed in some cases when the value is an
empty string:
declare -n r; : ${r=}declare -n r; r=""declare -n r; printf -v r ''
r=""; declare -n r
Each of these result in:
$ declare -p rdeclare -n r=""
Which itself is invalid:
$ declare -n r=""
bash: declare: `': not a valid identifier
This new nameref takes assignments but doesn’t seem to do anything with
them. It does cause at least one segfault though:
$ declare -n r; r=""
$ export r # or readonly r
Segmentation fault: 11