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

Re: Speaking of dangerous referents

Bart Schaefer wrote:
> % empty=()
> % loop='empty[${(P)loop}]'
> % print ${(P)loop}
> zsh: segmentation fault (core dumped)  zsh -f

And in 51399 on namerefs:
> Circular references hidden inside subscripts end up expanding to empty
> string, as do command substitutions with the NO_EXEC trick.

That surprises me. I can't see any executions occurring. Would making
(P) a little safer by applying the NO_EXEC trick to it too fix that seg
fault. Or did you have a different fix in mind? Are there sane uses to
(P) with nasty stuff like hidden command substitutions. We have (e) and
eval which are at least explicit in their dangers.

If genuine uses surface later (PP) could turn on the dangerous form. Or
you might argue that we should support (PP) for the safe form.

Making (P) safer could be another use for the FUTURE option I suggested
in the final paragraph of 51281 - perhaps very few people (if any) were
still reading at that point so it may have been overlooked.


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