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

[BUG] Strange auto-load behaviour when function name contains hyphen



Hey again. :/

The documentation states that function files intended for zsh-style auto-loading
are allowed to contain a 'simple definition' (`foo() { ... }`) if that's the
only thing in the file. This seems to work fine... except when the function name
contains a hyphen. Illustration:

  % fpath=( . $fpath )

  % print -r 'foo_bar() print foo_bar' > foo_bar
  % autoload -Uz foo_bar
  % foo_bar
  foo_bar

  % print -r 'foo-bar() print foo-bar' > foo-bar
  % autoload -Uz foo-bar
  % foo-bar # No output — function is only defined now
  % foo-bar # Second call actually executes the function
  foo-bar

In the foo-bar case, stripkshdef() doesn't strip the definition out because the
Eprog->strs value for the function contains weird characters (and thus fails the
strcmp() against the expected name). Specifically, it seems the strs value
contains \x9b in place of the hyphens.

Not sure what the significance of that is; that's about as far as i could follow
it, unfortunately.

dana




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