Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] FPATH, ZSH, oh-my-zsh, distrobox breaks shell together #1627

Closed
lpuv opened this issue Dec 5, 2024 · 3 comments · Fixed by #1636
Closed

[Error] FPATH, ZSH, oh-my-zsh, distrobox breaks shell together #1627

lpuv opened this issue Dec 5, 2024 · 3 comments · Fixed by #1636
Labels
bug Something isn't working

Comments

@lpuv
Copy link

lpuv commented Dec 5, 2024

Describe the bug
Using oh-my-zsh on the host and trying to enter into a container will error out because FPATH is messed up somehow. The workaround is that once in the container, you must unset FPATH; zsh.
To Reproduce

  1. Install ZSH and oh-my-zsh on the host
  2. Enter into a container
  3. broken

Expected behavior
No errors. Using bash works fine.

Logs

/home/luna/.oh-my-zsh/oh-my-zsh.sh:127: compinit: function definition file not found
/home/luna/.oh-my-zsh/oh-my-zsh.sh:150: zrecompile: function definition file not found
/home/luna/.oh-my-zsh/lib/async_prompt.zsh:144: add-zsh-hook: function definition file not found
/home/luna/.oh-my-zsh/lib/completion.zsh:78: bashcompinit: function definition file not found
/home/luna/.oh-my-zsh/lib/directories.zsh:34: command not found: compdef
/home/luna/.oh-my-zsh/lib/git.zsh:49: is-at-least: function definition file not found
/home/luna/.oh-my-zsh/lib/termsupport.zsh:108: add-zsh-hook: function definition file not found
/home/luna/.oh-my-zsh/lib/termsupport.zsh:109: add-zsh-hook: function definition file not found
/home/luna/.oh-my-zsh/lib/termsupport.zsh:163: add-zsh-hook: function definition file not found
/home/luna/.oh-my-zsh/lib/theme-and-appearance.zsh:2: colors: function definition file not found
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:101: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:183: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:211: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:218: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:223: is-at-least: function definition file not found
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:248: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:275: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:291: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:302: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:305: is-at-least: function definition file not found
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:313: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:316: is-at-least: function definition file not found
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:332: command not found: compdef
/home/luna/.oh-my-zsh/plugins/git/git.plugin.zsh:380: is-at-least: function definition file not found
/home/luna/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh:859: is-at-least: function definition file not found
/home/luna/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh:864: add-zsh-hook: function definition file not found
/home/luna/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh:105: is-at-least: function definition file not found
/home/luna/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh:420: is-at-least: function definition file not found
zsh-syntax-highlighting: Failed to load add-zsh-hook. Some speed optimizations will not be used.
zsh-syntax-highlighting: failed loading add-zsh-hook.
zsh-syntax-highlighting: failed loading add-zsh-hook.
/home/luna/.oh-my-zsh/plugins/dirhistory/dirhistory.plugin.zsh:61: add-zsh-hook: function definition file not found
(eval):90: add-zsh-hook: function definition file not found
(eval):91: add-zsh-hook: function definition file not found

Desktop (please complete the following information):
I am using podman version 5.2.5, and distrobox version 1.6.0.1 on Fedora Silverblue 41, using the RPM package for distrobox.

@lpuv lpuv added the bug Something isn't working label Dec 5, 2024
@jgroman
Copy link
Contributor

jgroman commented Dec 18, 2024

I had the same problem. After some troubleshooting turns out in my case the problem was caused by shell FPATH variable being exported in .zshrc on host. Some installer script added these two lines at the beginning of my host .zshrc:

# Add deno completions to search path
if [[ ":$FPATH:" != *":/home/user/.zsh/completions:"* ]]; then export FPATH="/home/user/.zsh/completions:$FPATH"; fi

Exporting makes FPATH environment variable and as such it is later picked up by distrobox and imported into guest shell where it breaks the default "built-in" fpath.

Seems that exporting FPATH is not necessary (https://unix.stackexchange.com/questions/774317/why-is-fpath-not-listed-in-env-output) so as a workaround you could try to make sure FPATH is not exported in your .zshrc (or anywhere else) before invoking distrobox-enter.

I suppose the proper fix would be for distrobox to ignore FPATH environment variable.

@jgroman
Copy link
Contributor

jgroman commented Dec 18, 2024

Please see PR #1636

@lpuv
Copy link
Author

lpuv commented Jan 4, 2025

thank you @jgroman! hope it gets merged!

@89luca89 89luca89 linked a pull request Jan 19, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants