zsh-workers
 help / color / mirror / code / Atom feed
* Parameter name argument of sysread, read, print -v, what else?
@ 2024-01-17  4:44 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2024-01-17  4:44 UTC (permalink / raw)
  To: Zsh hackers list

In his "slurp" example, Roman wrote:
  sysread 'content[++i]'

Nifty, but raises an issue we've tackled elsewhere, e.g.

 horse='content[$(eval $trojans)]'
 sysread $horse

This is disallowed in named references by imposing noexec around the
subscript expansion. There's an uncommitted patch from Oliver
(workers/52293) using a similar technique for a similar concern about
[[ -v $var ]] (raised in users/29343).

In the nameref and [[ -v ... ]] cases the issue arose because of
calling getvalue() and is fixed by switching to fetchvalue().  For
sysread etc. the problem is from calling setsparam() which calls
assignsparam() ... which calls getvalue().  Similarly for setaparam()
+ assignaparam().

It would break swaths of stuff to to restrict subscript expansion in
every case of setting a parameter, so we can't attack this at the
lowest level without altering call signatures of at least some portion
of the function chain.

Is this just something we acknowledge and perhaps document?  Thoughts?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-17  4:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17  4:44 Parameter name argument of sysread, read, print -v, what else? Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).