Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Speaking of dangerous referents
- X-seq: zsh-workers 51408
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Speaking of dangerous referents
- Date: Sun, 12 Feb 2023 00:34:34 -0800
- Archived-at: <https://zsh.org/workers/51408>
- In-reply-to: <91776-1676188804.595308@S3xK.VfOi.LVPX>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7bd5tHQ8_ZFuyheUrTStm8pR826jH1LB-vMdEnv14nH0w@mail.gmail.com> <67689-1675827940.088548@BxvG.D9_b.7RzI> <CAH+w=7ZFq_MyNtPVetDt84Zp8dnCQXis3p=2sKP018GZ-VTd0g@mail.gmail.com> <12608-1675903622.800470@Xj82.e3y1.svhG> <CAH+w=7ZZUCqYe6w1ZqZZKR6iLsZH0SDDXyzwgTU93nxx6bmxjQ@mail.gmail.com> <66045-1675975796.128039@FBF_.0yMO.Y8fk> <CAH+w=7bcqc8SsRxsht0QFyXy=DYzj6nVaBFhdzQ5MrBB+yBz+A@mail.gmail.com> <CAH+w=7YVJO-HkneMpnfBbqBztPaXdXTD=mo-vHbdUW00TiFVBQ@mail.gmail.com> <CAH+w=7YuT3aHL4WDcunftO8xj48A4oQR5Smo0ryUsTrF=xOpQQ@mail.gmail.com> <CAH+w=7aDtVrTseUGcVSPebA0wzwhsG9ToZDWFARFWePK3KNDyg@mail.gmail.com> <91776-1676188804.595308@S3xK.VfOi.LVPX>
On Sun, Feb 12, 2023 at 12:00 AM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> 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.
I apologize, the reference to NO_EXEC only applies to the clause about
command substitutions. The circular references are handled by using
tagging to detect/abort the loop during nameref resolution. I'm
uncertain whether a similar approach could be used for (P) and haven't
dug into it, I didn't want to mix a patch for that into the patches
for namerefs.
> 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?
It wouldn't and I didn't, at least not yet. It would have to be
something along the lines of the "math recursion limit exceeded"
handling. There are two or three other places in the code where there
are comments rejecting arbitrary limits on recursion so this might be
something we don't want to fix.
> 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.
It would be helpful to know whether any of the uses of (P) in the
existing contributed and completion functions etc. actually rely on
expanding command substitutions. It would be pretty unlikely that
they rely on self-reference.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author