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 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 didn't get any reaction from the following, however.

pws

diff --git a/Src/params.c b/Src/params.c
index 089a958..b1420f7 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -4058,6 +4058,8 @@ char *
 colonarrgetfn(Param pm)
 {
     char ***dptr = (char ***)pm->u.data;
+    DPUTS(!(pm->node.flags & PM_SPECIAL),
+	  "Wrong get fn for npn-special tied array");
     return *dptr ? zjoin(*dptr, ':', 1) : "";
 }
 
@@ -4066,6 +4068,8 @@ void
 colonarrsetfn(Param pm, char *x)
 {
     char ***dptr = (char ***)pm->u.data;
+    DPUTS(!(pm->node.flags & PM_SPECIAL),
+	  "Wrong set fn for npn-special tied array");
     /*
      * We have to make sure this is never NULL, since that
      * can cause problems.
@@ -4085,6 +4089,7 @@ char *
 tiedarrgetfn(Param pm)
 {
     struct tieddata *dptr = (struct tieddata *)pm->u.data;
+    DPUTS(pm->node.flags & PM_SPECIAL, "Wrong get fn for special tied
array");
     return *dptr->arrptr ? zjoin(*dptr->arrptr, STOUC(dptr->joinchar), 1) :
"";
 }
 
@@ -4093,6 +4098,7 @@ void
 tiedarrsetfn(Param pm, char *x)
 {
     struct tieddata *dptr = (struct tieddata *)pm->u.data;
+    DPUTS(pm->node.flags & PM_SPECIAL, "Wrong set fn for special tied
array");
 
     if (*dptr->arrptr)
 	freearray(*dptr->arrptr);



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