Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH (not final)] (take three?) unset "array[$anything]"



On Fri, Jun 4, 2021 at 1:02 AM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
>
> It also means the lexer, a large and complex bit of code whose
> behaviour also depends on a the setting of a number of options
> will end up being exposed to user-supplied data (of the users of
> the zsh scripts, not just the users of zsh), which adds some
> level of risk.

This remark baffles me.  The exact same code is used for ${v/pat/repl}
among other things, I haven't added any new entry point to the lexer.

Still, we're continuing to banter about what I think is the
second-best solution anyway.

> Currently we can do (reliably):
>
>    read 'hash[$key]'

It's unfortunate that this is "reliable" because I'm pretty sure it's
totally unintentional and should be considered a bug.  "read" should
not be re-interpreting $key in its NAME parameter.

> and can't do (reliably)
>
>    read "hash[$key]"

That one ought to be reliable if using hash elements here is permitted at all.

> If we align with whatever solution we pick for unset, we're
> going to break a lot more scripts. I don't think we can touch
> those at least in the default mode operation.

I don't know how many is "a lot" here, because frankly this is
something I would never have thought of attempting in the first place
(particularly, relying on the buggy behavior of the single-quoted
case).  But I really want to STOP talking about this in the same
thread as the "unset" question.




Messages sorted by: Reverse Date, Date, Thread, Author