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

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

2021-06-03 11:12:19 -0700, Bart Schaefer:
> > If I understand correctly, the "stripquote" variant is the one
> > where the user can do:
> > That is where quotes are parsed and removed but otherwise
> > serve no purpose.
> I guess you can describe it that way, yes.

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.

> > That hardly helps with backward compatibility as users who did
> > work around the previous behaviour will still have to adapt
> > their work around
> The point of my previous analysis is that they probably will not have
> to adapt.  Your $MATCH workaround operates correctly with the
> stripquote version in nearly as many cases as it currently does (it is
> not foolproof for the current shell implementation).

If I understand correctly, that quote stripping removes one
level of quotes from tokens identified as string tokens provided
the lexer succeeded in tokenising the input, so any workaround
would have to escape/quote any shell special character to
guarantee the lexer succeeds.

> I agree that the literal variation is probably the one most useful to
> re-apply in cases like read, print -v, etc.

Note that read/print -v, etc. is radically different.

Currently we can do (reliably):

   read 'hash[$key]'

and can't do (reliably)

   read "hash[$key]"

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.


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