zplug icon indicating copy to clipboard operation
zplug copied to clipboard

Race condition in creating and using ~/.zplug/cache/theme.zsh

Open dfaure-kdab opened this issue 11 months ago • 1 comments

Describe the bug When I log into KDE plasma, it's restoring 9 konsoles with many tabs, running 74 zsh instances in total. In some of these, the zsh plugins don't get loaded, an error shows instead.

To Reproduce Steps to reproduce the behavior:

  1. Run KDE plasma
  2. Open 8 konsoles with 10 tabs in each
  3. Log out, log in
  4. See error in some of the terminal tabs: __zplug::core::load::from_cache:source:19: no such file or directory: /home/dfaure/.zplug/cache/theme.zsh

The file does exist though, and is clearly subject to race conditions:

$ cat /home/dfaure/.zplug/cache/theme.zsh
__zplug::core::load::as_theme --repo "romkatv/powerlevel10k" "/home/dfaure/.zplug/repos/romkatv/powerlevel10k/powerlevel10k.zsh-theme"
__zplug::core::load::as_theme --repo "romkatv/powerlevel10k" "/home/dfaure/.zplug/repos/romkatv/powerlevel10k/powerlevel9k.zsh-theme"
__zplug::core::load::as_theme --repo "romkatv/powerlevel10k" "/home/dfaure/.zplug/repos/romkatv/powerlevel10k/powerlevel10k.zsh-theme"
__zplug::core::load::as_theme --repo "romkatv/powerlevel10k" "/home/dfaure/.zplug/repos/romkatv/powerlevel10k/powerlevel9k.zsh-theme"

[these two lines get repeated 9 times in total]

Expected behavior No race condition, each zsh should load fully..

Screenshots N/A

Env (please complete the following information):

  • zplug version: no such command. But zplug --version says 2.4.2
  • zsh --version: zsh 5.9 (x86_64-suse-linux-gnu)
  • uname -a: Linux AsterixP15 6.13.0-1-default #1 SMP PREEMPT_DYNAMIC Mon Jan 20 07:26:08 UTC 2025 (1513344) x86_64 x86_64 x86_64 GNU/Linux

Minimal zshrc (with less than 30 lines)

Create a minimal reproducing set of configurations for this issue. Please remove all unnecessary parts!

source ~/.zplug/init.zsh

zplug "changyuheng/fz", defer:1
zplug "rupa/z", use:z.sh
zplug romkatv/powerlevel10k, as:theme, depth:1

if zplug check || zplug install; then
  zplug load --verbose
fi
source ~/.p10k.zsh

Additional context

dfaure-kdab avatar Feb 09 '25 22:02 dfaure-kdab

Workaround: switched to https://github.com/zimfw/zimfw and all konsole tabs loaded properly.

dfaure-kdab avatar Feb 09 '25 22:02 dfaure-kdab