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

Re: One possible answer to typeset vs. unset



On Fri, Dec 4, 2020 at 11:47 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> I've just noticed that the D04 test "Unsetting and recreation of tied
> normal parameters" silently crashes the test harness.  The fix for
> this is probably closely related to correcting the flags.

Not so closely related after all.  Unset of a tied local scalar left
it using tiedarr_gsu, even though the tie data was null.

That seems like an accident waiting to happen; I tested the patch
below on the master branch, and it still passes the full test suite.
I suggest it be applied there (it's already pushed to the declarednull
branch).

diff --git a/Src/params.c b/Src/params.c
index a0d4caf52..1a047d9e0 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3659,6 +3659,8 @@ unsetparam_pm(Param pm, int altflag, int exp)
        }

        zsfree(altremove);
+       if (!(pm->node.flags & PM_SPECIAL))
+           pm->gsu.s = &stdscalar_gsu;
     }

     /*




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