Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Crash of 4.2.0-dev-1
- X-seq: zsh-workers 19756
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Crash of 4.2.0-dev-1
- Date: Mon, 12 Apr 2004 01:04:07 +0000
- In-reply-to: <slrnc7jib7.567.mason@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <slrnc7hv93.g5j.mason@xxxxxxxxxxxxxxxxx> <1040411160938.ZM17940@xxxxxxxxxxxxxxxxxxxxxxx> <slrnc7jib7.567.mason@xxxxxxxxxxxxxxxxx>
On Apr 11, 10:40pm, Geoff Wing wrote:
}
} : Because files loaded with kshautoload have to contain the full function
} : definition
}
} OK, according to the manual zshbuiltins(1) in autoload:
}
} ... With ksh-style autoloading, the contents of the file will not be
} executed immediately. Instead, the function created will contain
} the contents of the file ...
Note that this excerpt applies specifically to +X with either -k or with
ksh_autoload set. The trailing part you've omitted goes on:
... plus a call to the function itself appended to it ...
You have to look in zshmisc(1) under "Autoloading functions" to find the
real explanation of ksh_autoload:
If the KSH_AUTOLOAD option is set, or the file contains
only a simple definition of the function, the file's con-
tents will be executed. This will normally define the
function in question, but may also perform initialization,
which is executed in the context of the function execu-
tion, and may therefore define local parameters. It is an
error if the function is not defined by loading the file.
Otherwise, the function body (with no surrounding `func-
name() {...}') is taken to be the complete contents of the
file. ...
} : Whereas zsh expects it to have been defined as:
} :
} : kshtest () {
} : kshtest () {
} : print "Running kshtest"
} : unfunction kshtest
} : }
} : kshtest "$@"
} : }
}
} This is what I get.
If in fact your file "kshtest" contains exactly the two lines
print "Running kshtest"
unfunction kshtest
and you ran
setopt ksh_autoload
autoload +X -k kshtest
then it should be impossible for you to have gotten the kshtest-within-
kshtest form you just quoted. If you *do* somehow get the nested def'n
shown above, then the bug *won't* be tickled -- the but only happens if
the nested kshtest def'n does *not* appear, but both the "unfunction"
and the call with "$@" *do* appear.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author