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

Re: PATCH: separate watch/log functionality out into a module



On Sun, Oct 31, 2021 at 5:07 PM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> The autoloading of modules from parameters is not ideal where the
> parameters come from the environment.

Hm.  What would the right behavior be?  Do we need a flag on the
autoloaded parameter for whether the value is [not?] allowed to come
from the environment?  PM_DONTIMPORT seems potentially relevant.

> For an example with an unpatched zsh, this is not great:
>   options=foo zsh -df
>   zsh: options: attempt to set slice of associative array
> And unlike for WATCH, that's a fatal error so zsh exits.

I think you're misinterpreting what's happening.  If I use gdb:

(gdb) set environ options=foo
(gdb) run -df
Starting program: Src/zsh -df
zsh: Can't add module parameter `options': parameter already exists
ubuntu%

I get your error if I try to assign to options in the environment from
the current zsh:

ubuntu% options=foo Src/zsh -df
zsh: options: attempt to set slice of associative array
ubuntu%

But the shell where I did that does not exit, the error aborts the
command so no new shell is ever started.

If I unset options first, the new shell complains:

ubuntu% (echo $$; unset options; options=foo Src/zsh -df )
695688
zsh: Can't add module parameter `options': parameter already exists
ubuntu% echo $$
695694

(this is all without your patches)




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