Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Use realparamtab and don't dereference special parameters in zle code
- X-seq: zsh-workers 54845
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Use realparamtab and don't dereference special parameters in zle code
- Date: Mon, 22 Jun 2026 21:28:49 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qNeW0QqsyKQilpyb1DkA2WSjgDIcSIJUPchA7EMWkjU=; fh=RngAOd9wlRc8Glv1v2GOfDUnq2FsyrczungEY8JNfXY=; b=JdCZWpR9Ierq5/ngEZrxLe1J8XaGBjwRQ/a3HM/zvkMYKcIb2OEm1cdCngTUaj03/k N4OBKX6mAC3IVQ21xEJezSZmxuAe2wBkW9GeWd95pZfxAklxyEAAGaOBMeDZS5O9emP9 oDIdPLEHRN4cVk75RUGyliD88x0C6XYwMTrJ7puNGaL1auJ+Cp2q7mILs9UXGzKOx/Px aoE6RvO0GDkNK5GIR2N219lKt4FsoKQ0VKKafdm3DtB5cRDBg6/1Sg6wZdTf1k6HkpGA xhH3nQtHJsG0XWpH1rHpnnGOVlK6jUvxOOATLQE3PTaD63LULdOaQsgpToHK0/qJ15pu bpGw==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1782188941; cv=none; d=google.com; s=arc-20240605; b=XcBey4XLaRuEffgjSRAVOWAk1KsqJGn4zeIC1JEi5x0rmUJtX4WY8w2IUQ9Rx1CAcH Pp9YROrrqgEArOE/iErLlSOwVVBB4bRAtgt6R+0mgUR6mhxAYfVlrn5W4QOfk+jkjcN4 rLAg3NiVav5U0DhxwuP3IJ856PPN9VVmnpqwfBOx1srO/rooYzAHhUJF2jHIDsuwioKb xy6G8KnU0fKAASuGdLjS+R2wHJ+JYGtQd+pzAte3KDXZovjxqML4NLm82IzzO28GRz3B ki8fa7My7pWmnG2QNs94fo9GjG/i405nWWbulhozm2oXInpmwQ52BOx7nHgoEH3g1QNO iJnw==
- Archived-at: <https://zsh.org/workers/54845>
- In-reply-to: <CAGdYchuj-=WwyprQGo-V9k2KY4hNW_dN0L7qHHmmtsJRAcry6A@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchuj-=WwyprQGo-V9k2KY4hNW_dN0L7qHHmmtsJRAcry6A@mail.gmail.com>
On Thu, Jun 18, 2026 at 4:56 PM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> - Use realparamtab and don't dereference special parameters in zle code
>
In makecompparams(), is it really always guaranteed that paramtab ==
realparamtab on entry to the function? (See hardwired reset at the
end.) The save/restore with "tht" seems like otherwise-harmless
defensive programming.
(Please excuse that copy/paste may have squashed tab indentation)
@@ -1340,23 +1339,21 @@ void
makecompparams(void)
{
Param cpm;
- HashTable tht;
addcompparams(comprparams, comprpms);
if (!(cpm = createparam(
COMPSTATENAME,
PM_SPECIAL|PM_REMOVABLE|PM_SINGLE|PM_LOCAL|PM_HASHED)))
- cpm = (Param) paramtab->getnode(paramtab, COMPSTATENAME);
- DPUTS(!cpm, "param not set in makecompparams");
+ cpm = (Param) realparamtab->getnode2(realparamtab, COMPSTATENAME);
+ DPUTS1(!cpm, "param %s not set in makecompparams", COMPSTATENAME);
comprpms[CPN_COMPSTATE] = cpm;
- tht = paramtab;
cpm->level = locallevel + 1;
cpm->gsu.h = &compstate_gsu;
cpm->u.hash = paramtab = newparamtable(31, COMPSTATENAME);
addcompparams(compkparams, compkpms);
- paramtab = tht;
+ paramtab = realparamtab;
}
>
Why remove PM_NAMEREF in makezleparams()? Just because right now
there are no ZLE parameters that are named references doesn't mean
there might not be at some point?
switch(PM_TYPE(zp->type)) {
case PM_SCALAR:
- case PM_NAMEREF:
pm->gsu.s = zp->gsu;
break;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author