Closed siebenmann closed 1 month ago
I have updated the branch IS718-FPATH to change it so that only zsh calls compinit -C. Please test this branch to see if it works for you.
Unfortunately I'm not in a position to test this. I don't use Lmod myself; it was installed on my Fedora 40 machine through defaults (or so I assume), and so I'm not up to manually installing a non-RPM version.
Thank you for submitting this bug report. I have an even better solution in the next release of Lmod. Closing this issue. Thanks!
Describe the bug
Lmod bash initialization attempts to run 'compinit -c' if your system also has zsh installed, which can trigger Bash's command not found' handling, which can stall for significant amounts of time, stalling shell startup. The 'compint -c' invocation comes in
__build_FPATH_for_zsh_ksh
, which is invoked later in init/bash.in if your shell is ksh or Bash. In Bash, which has no compinit builtin, this can trigger an existing Bashcommand_not_found_handle
function if one has been set up earlier in the shell startup process. An environment where this happens is Fedora 40 with the PackageKit-command-not-found package installed, which installs a command not found handler that will run '/usr/libexec/pk-command-not-found', which can take ten seconds or more.(I have not attempted to reproduce this with the latest Lmod release; Fedora currently ships 8.7.48, but the init/bash.in code looks unchanged between the two versions and the Git tip.)
Reproduction
It's likely that this happens only the first time you log in (either system-wide or for a particular user using Bash as their login shell), which will mean you'll want to reproduce this in a VM that you can reboot freely. To reproduce you'll need a Fedora 40 environment with a user who has Bash as their shell and can be logged in over ssh; this Fedora 40 environment should have Lmod, PackageKit-command-not-found, and zsh all installed. With this setup, (re)boot the VM and log in over SSH as your target user. Observe the visible startup stall. Add instrumentation to /usr/share/lmod/lmod/init/bash to clearly identify the source of the stall.