Bug#1144635: zsh: broken by the FPATH environment variable defined by bash / lmod

Vincent Lefevre <[email protected]>
Newsgroups gmane.linux.debian.devel.bugs.rc
Message-ID <[email protected]>
Package: zsh
Version: 5.9-8+b23
Severity: serious
Tags: upstream

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).

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.

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.

-- Package-specific info:
Packages which depend, recommend, suggest or enhance a zsh package and hence may provide code meant to be sourced in .zshrc:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version       Architecture Description
+++-==============-=============-============-===============================================================
ii  parallel       20240222+ds-2 all          build and execute command lines from standard input in parallel

Packages which provide vendor completions:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                Version          Architecture Description
+++-===================-================-============-=======================================================================
ii  borgbackup          1.4.0-5          amd64        deduplicating and compressing backup program
ii  bubblewrap          0.11.0-2+deb13u1 amd64        utility for unprivileged chroot and namespace manipulation
ii  curl                8.14.1-2+deb13u4 amd64        command line tool for transferring data with URL syntax
ii  dpkg-dev            1.22.22          all          Debian package development tools
ii  git-annex           10.20250416-2    amd64        manage files with git, without checking their contents into git
ii  jupyter-core        5.7.2-5          all          Core common functionality of Jupyter projects (tools)
ii  legit               1.2.0.post0-5    all          Git extension to assist in manipulating branches
ii  mercurial-common    7.0.1-2          all          easy-to-use, scalable distributed version control system (common files)
ii  ninja-build         1.12.1-1         amd64        small build system closest in spirit to Make
ii  pass                1.7.4-7          all          lightweight directory-based password manager
ii  python3-argcomplete 3.6.2-1          all          bash/zsh tab completion for argparse (for Python 3)
ii  sqv                 1.3.0-3+b2       amd64        OpenPGP signature verification program from Sequoia
ii  systemd             257.13-1~deb13u1 amd64        system and service manager
ii  udev                257.13-1~deb13u1 amd64        /dev/ and hotplug management daemon
ii  wl-clipboard        2.2.1-2          amd64        command line interface to the wayland clipboard
ii  zathura             0.5.11-1         amd64        document viewer with a minimalistic interface

dpkg-query: no path found matching pattern /usr/share/zsh/vendor-functions/


-- System Information:
Debian Release: 13.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.96+deb13-amd64 (SMP w/80 CPU threads; PREEMPT)
Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages zsh depends on:
ii  debianutils  5.23.2
ii  libc6        2.41-12+deb13u3
ii  libcap2      1:2.75-10+deb13u1+b1
ii  libtinfo6    6.5+20250216-2
ii  zsh-common   5.9-8

Versions of packages zsh recommends:
ii  libgdbm6t64   1.24-2
ii  libncursesw6  6.5+20250216-2
ii  libpcre2-8-0  10.46-1~deb13u1

Versions of packages zsh suggests:
ii  zsh-doc  5.9-8

-- no debconf information
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.