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

Re: Another minor =~ glitch



On Sat, Apr 8, 2017 at 7:23 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Fri, Apr 7, 2017 at 6:58 PM, Roland Eggner <edvz2@xxxxxxxxxxxxxxxxxx> wrote:
>>
>> Regression observed since my Zsh update
>> from bb6c08b51a079870 to fc1fedda954e1d10.
>
> Thanks, that narrows it down to this:
>
> diff --git a/Src/cond.c b/Src/cond.c
> index 9b739f6..a638412 100644
> --- a/Src/cond.c
> +++ b/Src/cond.c
> @@ -139,9 +139,9 @@ evalcond(Estate state, char *fromtest)
>                 l = 2;
>             }
>             if (name && IS_DASH(name[0]))
> -               errname = name;
> +               untokenize(errname = name);
>             else if (strs[0] && IS_DASH(*strs[0]))
> -               errname = strs[0];
> +               untokenize(errname = strs[0]);
>             else
>                 errname = "<null>";
>             if (name && IS_DASH(name[0]) &&

This patch causes segfaults for me (in the first hunk at least)
because name can be a readonly string. Should we ztrdup it?

-- 
Mikael Magnusson



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