Skip to content

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

@dfaure-kdab

Description

@dfaure-kdab

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 Implement update command #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions