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

Re: A serious bug in execution – where to debug?

Roman Perepelitsa wrote on Tue, 30 Jul 2019 21:46 +00:00:
> You should call `emulate -L zsh` from every functions that can be
> called by any code other than yours. It's almost impossible to write
> code that works the same way with all combinations of options. In my
> public code I also unset aliases. These defensive measures reduce the
> number of bug reports by *a lot*. People really seem to like creating
> global aliases with single-letter names.

z-sy-h also does 'emulate -L' and unsets aliases.  I wonder if there
should be a built-in way to do this, in order to make it easier to write
plugins?  Perhaps a «source -U foo.zsh» syntax, as in autoload?

> I'll probably start calling `disable -f` for all builtins I use.

I wonder if you might be throwing the baby out with the bathwater here.
Aren't there legitimate use-cases for writing shadowing functions?  For
example, what if somebody does «zle() { typeset -p funcstack >&2; zle "$@" }»
for debugging purposes?

(And yes, I'm aware compsys and z-sy-h both use 'command' and 'builtin' in places..)

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