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

Re: [PATCH] [long] typeset doesn't report tied parameters (and related issues)



On Tue, 2018-10-09 at 10:02 +0100, Peter Stephenson wrote:
> On Mon, 2018-10-08 at 16:58 +0000, Daniel Shahaf wrote:
> > Peter Stephenson wrote on Mon, 08 Oct 2018 17:43 +0100:
> > So the lex.c error may be an independent issue.  The link to the typeset
> > change is probably the failure address, 0x3A, which is the hex value of
> > the ASCII colon character, which is the joinchar of $MANPATH.
> That's interesting and points to a problem along the lines I suggested
> --- confusion between special and non-special tied variables.  MANPATH
> as a special tied variable uses colonarrsetfn() / colonarrgetfn() to set
> and retrieve values, which uses a colon implicitly, not from the
> parameter structure.  Non-special tied arrays have a tieddata structure
> in the data.

I wonder if this has anything to do with it?  I haven't definitely
verified we can get here in the case newly tested but it's not obvious
we can't.

pws

diff --git a/Src/builtin.c b/Src/builtin.c
index b81acdb..ca3ef23 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2258,7 +2258,7 @@ typeset_single(char *cname, char *pname, Param pm,
UNUSED(int func),
 	    } else if (pm->env && !(pm->node.flags & PM_HASHELEM))
 		delenv(pm);
 	    DPUTS(ASG_ARRAYP(asg), "BUG: typeset got array value where scalar
expected");
-	    if (altpm) {
+	    if (altpm && !(pm->node.flags & PM_SPECIAL)) {
 		struct tieddata* tdp = (struct tieddata *) pm->u.data;
 		if (tdp) {
 		    if (tdp->joinchar != joinchar && !asg->value.scalar) {



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