[Pkg-zsh-devel] Bug#1144635: Bug#1144635: zsh: broken by the FPATH environment variable defined by bash / lmod
Vincent Lefevre
vincent at vinc17.net
Mon Aug 17 18:32:22 BST 2026
Control: forwarded -1 https://www.zsh.org/mla/workers/2026/msg00939.html
On 2026-08-17 16:35:32 +0200, Michael Prokop wrote:
> Github is currently down
> (https://www.githubstatus.com/incidents/zkxwbgr0cnmx),
> so I can't check that reference.
I don't think it really matters anyway.
> But is it actually necessary and a good idea, that lmod
> *exports* variables like that?
Probably not. IMHO, the right solution would be to ask lmod users
to run something like "source ..." from their own init file.
Moreover, while I don't know what lmod's FPATH-related code should
do, it does not seem to behave as intended:
unset __zsh_fpath
if [ -n "${ZSH_VERSION+x}" ] && ! (autoload -U compinit && compinit -C 2> /dev/null) ; then
__zsh_fpath=$(unset FPATH; zsh -f -c 'echo $FPATH')
fi
export FPATH=$(/usr/share/lmod/lmod/libexec/addto --append FPATH ${__zsh_fpath:-$FPATH} /usr/share/lmod/lmod/init/ksh_funcs)
unset __zsh_fpath
The goal of the
__zsh_fpath=$(unset FPATH; zsh -f -c 'echo $FPATH')
seems to get zsh's default $FPATH (for the first zsh in $PATH), so
that the lmod specific paths are appended. But what I can see is that
zsh's default $FPATH is overridden, because the "export FPATH=..." is
outside the "if". In any case, such a solution is ugly as if the user
has another zsh version installed on their machine and wants to run
it, the $FPATH (assuming that the intent of zsh is to honor it, which
I think is a major design bug) would be incorrect for the paths
associated with the zsh installation.
> > It appears that instead of ignoring the $FPATH environment variable
> > on startup, zsh sets $fpath to $FPATH.
>
> Right.
>
> > Note that the zshparam(1) man page says: "Some environment variables
> > are not imported for reasons of security or because they would
> > interfere with the correct operation of other shell features.",
> > which should be the case here.
>
> Do you mind brining this up to upstream yourself?
I've posted a message to zsh-workers and put the URL in "forwarded".
--
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
More information about the Pkg-zsh-devel
mailing list