From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: Really wierd problems with autoload
Date: Wed, 29 Mar 2000 16:33:38 +0000 [thread overview]
Message-ID: <1000329163338.ZM24969@candle.brasslantern.com> (raw)
I have a function "zman" that gets set up in my .zshrc:
--------------------------------------------------------
zman() {
local f
for f in ${^fpath:-/usr/local/lib/zsh/functions}/run-help
do
if [[ -f $f && -r $f ]]
then
unalias run-help
autoload run-help
HELPDIR=/usr/local/lib/zsh/help
FPATH=$f \run-help $1
return $?
elif [[ -f /usr/local/lib/zsh/help/$1 ]]
then less /usr/local/lib/zsh/help/$1
else man $1
fi
done
}
alias run-help zman
--------------------------------------------------------
This used to work, but in 3.1.6-dev-20 when I type ESC-h I get
run-help:9: run-help: function definition file not found
Now, it's not run-help line 9, it's zman line 9; and further by the time
zman finishes the function run-help IS correctly loaded, it just for some
reason won't execute. Subsequent uses of ESC-h execute the new run-help.
But that's not the really wierd problem.
In my .zshenv is this snippet:
----------------------------------------------------------------------
# Subshell because some versions of zsh stop sourcing on "bad option"
if (autoload -U)
then
fpath=(~/zshfun $fpath)
autoload ~/zshfun/*(N.:t)
# autoload -U ${^fpath[2,-1]}/*(N.:t) # compinit handles this
else
# This probably doesn't work in all versions
fpath=(~/zshfun /usr/local/lib/zsh/functions)
autoload $^fpath/*(N.:t)
fi
----------------------------------------------------------------------
This is supposed to set fpath correctly depending on whether the current
shell is 3.1.6+ (which has autoload -U) or not.
However, if I do this:
export FPATH
exec $ZSH_NAME
the (autoload -U) returns nonzero when the new shell starts up, even though
it really is 3.1.6-dev-20, and I end up with the wrong fpath so compinit
fails, etc. Once I've actually got a prompt, I can run (autoload -U) with
or without the subshell and get a zero exit status, but for some strange
reason it fails during reading of the .zshenv when there's an FPATH in the
environment. And it only happens on "exec", not upon running $ZSH_NAME as
a simple external command.
I noticed this because (wierd thing #3) FPATH becomes exported when zman
does "FPATH=$f \run-help $1" ... the old value of FPATH appears to be
restored properly after run-help fails, but if it was not exported before,
it is afterwards.
This is completely mystifying ... perhaps a garbage pointer is getting put
into the environment when FPATH is exported? But what does that have to
do with autoload -U failing? Maybe the whole subshell is crashing and the
fact that it's got an autoload command in it is a red herring? But it
fails completely silently and without leaving a core file or anything.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
reply other threads:[~2000-03-29 16:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1000329163338.ZM24969@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=zsh-workers@sunsite.auc.dk \
/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).