From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21538 invoked from network); 29 Mar 2000 16:34:10 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 Mar 2000 16:34:10 -0000 Received: (qmail 24235 invoked by alias); 29 Mar 2000 16:33:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10316 Received: (qmail 24213 invoked from network); 29 Mar 2000 16:33:51 -0000 From: "Bart Schaefer" Message-Id: <1000329163338.ZM24969@candle.brasslantern.com> Date: Wed, 29 Mar 2000 16:33:38 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: Really wierd problems with autoload MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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