Bug#1144635: [Pkg-zsh-devel] Bug#1144635: zsh: broken by the FPATH environment variable defined by bash / lmod

Michael Prokop <[email protected]>
Newsgroups gmane.linux.debian.devel.bugs.rc
Message-ID <[email protected]>
severity 1144635 important
thx

* Vincent Lefevre [Mon Aug 17, 2026 at 03:09:57PM +0200]:

> On a machine that has just been upgraded to trixie, I start zsh
> via a bash login shell (run by sshd). The issue is that when it
> is a login shell, bash defines the $FPATH environement variable
> to '/usr/share/lmod/lmod/init/ksh_funcs' as shown by
> 
>   echo "FPATH = '$FPATH'" >&2
> 
> at the beginning of the ~/.bash_profile file, which outputs:
> 
> FPATH = '/usr/share/lmod/lmod/init/ksh_funcs'
> 
> This is possibly due to /usr/share/lmod/8.7.60/init/bash from the
> lmod package, as mentioned at
> 
>   https://github.com/direnv/direnv/issues/858
> 
> (note that I'm not a direnv user... this was found by Google + AI).

Github is currently down
(https://www.githubstatus.com/incidents/zkxwbgr0cnmx),
so I can't check that reference.

But is it actually necessary and a good idea, that lmod
*exports* variables like that?

It looks like lmod pollutes the environment quiet a lot,
like e.g. also:

  LMOD_SETTARG_FULL_SUPPORT=no
  LMOD_VERSION=8.7.60
  MODULEPATH_ROOT=/usr/share/modulefiles
  LMOD_PKG=/usr/share/lmod/lmod
  LMOD_ROOT=/usr/share/lmod
  BASH_ENV=/usr/share/lmod/lmod/init/bash
  LMOD_sys=Linux
  MODULEPATH=/etc/lmod/modules:/usr/share/lmod/lmod/modulefiles/
  LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
  BASH_FUNC_ml%%=() {  eval "$($LMOD_DIR/ml_cmd "$@")"
  }
  BASH_FUNC_module%%=() {  if [ -z "${LMOD_SH_DBG_ON+x}" ]; then
   case "$-" in 
   *v*x*)
   __lmod_sh_dbg='vx'
   ;;
   *v*)
   __lmod_sh_dbg='v'
   ;;
   *x*)
   __lmod_sh_dbg='x'
   ;;
   esac;
   fi;
   if [ -n "${__lmod_sh_dbg:-}" ]; then
   set +$__lmod_sh_dbg;
   echo "Shell debugging temporarily silenced: export LMOD_SH_DBG_ON=1 for Lmod's output" 1>&2;
   fi;
   eval "$($LMOD_CMD shell "$@")" && eval "$(${LMOD_SETTARG_CMD:-:} -s sh)";
   __lmod_my_status=$?;
   if [ -n "${__lmod_sh_dbg:-}" ]; then
   echo "Shell debugging restarted" 1>&2;
   set -$__lmod_sh_dbg;
   fi;
   unset __lmod_sh_dbg;
   return $__lmod_my_status
  }

> Such a setting completely breaks zsh, which outputs
> 
> zsh:1: url-quote-magic: function definition file not found
> 
> each time I type a key (the key has no other effect, i.e. the
> command line at the prompt remains empty, so I need to type Ctrl-D
> to quit zsh).
> 
> 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?

regards
-mika-
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEM8yxNkAa/shDo4djlqh4crfqNzcFAmqDHDIACgkQlqh4crfq
NzeSBRAAtMPrtQSRte/5QTJEkkw56W06h9SMFC/O05OzgkOvjR2WaFyhGrlNe3PL
RVmXrJRJ8P56sUPq3fMSZDhdQkzxuDymdJWARkihjwGJ2o4bVDWNuNpsPnvQ5RJD
Nng7VwiggToGo2BtsBiyaguRY0Bp57DKVGSv4nbQ5j+tHBBwHalrGOhldalFCo/O
aa+nczjO6+uaFxg2QxTzNIn2W83gx1jSfFaJ6ck/vTpuhWu0GPAokYfnaYch03zV
S98qbdafcgtQbvj5lca5roLwv7Uh37+kT3B5NAZXKJw+OVXAUJlZhplAbf2TZidm
7cg78568Sjw+JUejozeW2AT1xOVcQfw/MnfPSUfvvo12D6XPGNJUtotGICgwTmWN
gAIhsmAARCNgVUVB9w9lWLi5S12BpMdDoJp36jHA8pbZe/2ZvbQ1Bg6/3ut+HVfH
NuOBYvDu+8WqQKGHTh1Tt2vvYl7ib4jHkzY4zwM4lfeeaaULolddEWKzf2hj7yrM
Wm8GdS+f/RMa1KrbKquQg10z7/8xywygPskYo87gtU0A8Xmkl4v5j1Gt1mX2m1eV
CacMPlrTnSB5hfz5gPoRHOBt5MAUWQfgY1BTAIHiEbSY6hDmaSZFVN+kbik0S3pu
bhYFIajDUGhiG86ws2KSIi6MEM1TcAnL5ZZ4Jxbc1DNNIhnylvw=
=rg5p
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.