zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: zsh-workers@zsh.org
Subject: [BUG] Strange auto-load behaviour when function name contains hyphen
Date: Thu, 14 Dec 2017 00:46:29 -0600	[thread overview]
Message-ID: <990A7EB2-C4BA-4E3D-99B3-7DA40846CBD1@dana.is> (raw)

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



             reply	other threads:[~2017-12-14  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171214064805epcas2p196a185a6c3c5e66640833d8dfa15d593@epcas2p1.samsung.com>
2017-12-14  6:46 ` dana [this message]
2017-12-14 10:01   ` Peter Stephenson
2017-12-14 10:28     ` Peter Stephenson
2017-12-14 17:21       ` dana
2017-12-15  2:33         ` dana
2017-12-15  9:09         ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990A7EB2-C4BA-4E3D-99B3-7DA40846CBD1@dana.is \
    --to=dana@dana.is \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).