Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] Strange auto-load behaviour when function name contains hyphen
- X-seq: zsh-workers 42120
- From: dana <dana@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] Strange auto-load behaviour when function name contains hyphen
- Date: Thu, 14 Dec 2017 00:46:29 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=vf0AXfMv/4E9RqQtGELZLrcFMZ0vyR0ljLyugFv/24o=; b=TEkZTFWgzl/hSVMtJnMTYUykffWFTUhqtkrzef7CVhrpl9vCyupGJM95sBNRO5rZqs WQxoI9bU96Gt5hHXMc4O73bZZVapPiJeVZ4Hl598PwBULTanj5xSdKaLZZK5eWA531EF W1wz3TXvzpUGXsqAQc10Xgm6cy0/+cVd++hq6dsPyqEd1WPYr/z7iRTQz+0TktWqL8hF L2gvIChT8j+z9UH9ec+sRjmBZE5ezhty8gGvyfdJJ/cc2/8I+ydJm0cPEnSmFdx/7J9w Rbt9DM4WelNiilTlC7E+a+b4uXKoMZJHkeK1xmHpAy0u9J/ePbmLKfeZwFKet1p6/yWD SRcw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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