z-shell / zpmod

⚙️ Zsh module transparently and automatically compiles sourced scripts
https://wiki.zshell.dev/ecosystem/plugins/zsh-modules
Other
21 stars 3 forks source link

[bug]: (eval):ZIModule_:1: can't write zwc file: /proc/self/fd/15.zwc #31

Open amogus07 opened 1 year ago

amogus07 commented 1 year ago

Environment

Fedora Workstation 39

Reproduction steps

  1. Install zpmod acording to the "Without Zi" section
  2. Add the two lines at the top of $ZDOTDIR/.zshrc according to the instructions

Expected behavior

zpmod operates normally according to README.md

Current behavior

Upon opening a new terminal session, the following message appears: "(eval):ZIModule_:1: can't write zwc file: /proc/self/fd/15.zwc"

Code snippet

module_path+=( "/home/konstantink/.zi/zmodules/zpmod/Src" )
zmodload zi/zpmod

# zsh plugin management functions
export ZPLUGINDIR="$ZDOTDIR/plugins"
getplugin () {
    url=$1
    reponame=$(echo "$url" | frawk -F/ '{print $NF}' | sed -e 's/.git$//')
    git clone "$url" "$ZPLUGINDIR/$reponame"
}

loadplugin () {
    for name in "$@"; do
        zplugin="$ZPLUGINDIR/$name/$name.plugin.zsh"
        [[ -f "$zplugin" ]] || echo "plugin $name not found..." && . "$zplugin" || echo "failed to load  $name"
    done
}

export FPATH="$ZDOTDIR/completions/eza/completions/zsh:$FPATH"

# Enable colors and change prompt:
#autoload -U colors && colors   # Load colors
#PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
setopt autocd       # Automatically cd into typed directory.
stty stop undef     # Disable ctrl-s to freeze terminal.
setopt interactive_comments

# History in cache directory:
HISTSIZE=10000000
SAVEHIST=10000000
HISTFILE="$HOME/.local/share/zsh_history"

# Basic auto/tab complete:
autoload -U compinit bashcompinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
bashcompinit
_comp_options+=(globdots)       # Include hidden files.
eval "$(register-python-argcomplete pipx)"

loadplugin zsh-autosuggestions H-S-MW zsh-editing-workbench zsh-fancy-completions zui zbrowse

. "$HOME/.cargo/env"

path_append () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
        PATH="${PATH:+$PATH}:$1"
    esac
}
# include .local/bin
path_append "$HOME/.local/bin"

# include .bin
path_append "$HOME/.bin"

# include spicetify path
path_append "$HOME/.spicetify"

# include volta path
export VOLTA_HOME="$HOME/.volta"
path_append "$VOLTA_HOME/bin"

fastfetch

eval "$(navi widget zsh)"
eval "$(zoxide init zsh)"
eval "$(starship init zsh)"
loadplugin F-Sy-H

. "$HOME/.config/broot/launcher/bash/br"

Additional information

I don't use Zi

Self-service

Have you read the Contributing Guidelines?

Are you familiar with the Contributor Covenant Code of Conduct?

Contact Details

konstantinkreutz@gmail.com

ss-o commented 1 year ago

Hi @amogus07 :wave:

I need to be able reproduce the issue, here are some tips to narrow it down:

Load only zpmod module and check if the issue persists. If yes, then I need your machine and environment information so can re-reproduce the an issue. If no, then the issue is caused by something else, and you can find what it is by adding code snippets back to .zshrc, but in parts until you find what exactly caused it.

amogus07 commented 12 months ago

@ss-o It seems starship is the culprit

amogus07 commented 11 months ago

So, is there anything I can do about it?

ss-o commented 11 months ago

So, is there anything I can do about it?

I am guessing that Starhip or its related files are located where zpmod module is missing permissions. For example, if Starship is located at /usr/bin/starship, then migrating it to
~/.local/bin/starship (and all other files if any) should solve the issue :thinking:

amogus07 commented 11 months ago

I am guessing that Starhip or its related files are located where zpmod module is missing permissions. For example, if Starship is located at /usr/bin/starship, then migrating it to ~/.local/bin/starship (and all other files if any) should solve the issue 🤔

tried that, didn't work

ss-o commented 11 months ago

@amogus07 have you tried to profile/debug the .zshrc loading? E.g.:

Place the following at the top of .zshrc:

[[ $ZSHRC_PROFILE -gt 0 ]] && zmodload zsh/zprof

Then execute ZSHRC_PROFILE=1 zsh and run zprof > profile.txt to write the details.

If you have no luck identifying the issue, you can try benchmark#method-1 or similar methods to pinpoint the issue.

Finally, you can run the docker container re-produce the issue, and share the instructions.

amogus07 commented 10 months ago

Could you explain how to set up the docker container for testing or provide some resources? I'm no familiar with docker.

ss-o commented 10 months ago

You can use https://github.com/z-shell/playground as an example, if you need additional support let me know :dart:

13steinj commented 7 months ago

I don't use starship and am also running into this.

Load only zpmod module and check if the issue persists. If yes, then I need your machine and environment information so can re-reproduce the an issue.

How can I verify that only the zpmod module is loaded? Use an empty zshrc/zprofile? That said AFAIK that's all that is loaded and it occurs.

zsh 5.9 via linuxbrew on ubuntu 22.04; if that helps / is needed.