-
Notifications
You must be signed in to change notification settings - Fork 25
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
State is lost on reboot by default when ~/.cache is a tmpfs #25
Comments
Repro steps: $ mkdir -p /tmp/test-home/{.cache,.long_term_cache}
$ vim /tmp/test-home/.zshrc
... (see below)
$ git clone https://github.com/z-shell/zi.git /tmp/test-home/zi-repo
...
$ HOME=/tmp/test-home zsh
# in nested shell
$ fast-theme free
$ cd; tree .cache .long_term_cache
.cache
└── fsh/
├── current_theme.zsh
├── current_theme.zsh.zwc
├── secondary_theme.zsh
└── secondary_theme.zsh.zwc
.long_term_cache
1 directory, 4 files Where source ~/zi-repo/zi.zsh
FAST_WORK_DIR=~/.long_term_cache/zsh--fast-syntax-highlighting
echo "FAST_WORK_DIR (before zi): $FAST_WORK_DIR"
zi light z-shell/F-Sy-H
echo "FAST_WORK_DIR (after zi): $FAST_WORK_DIR" And I get:
|
So my main question is: How to store the state of FSH outside of ~/.cache without changing |
Thanks, will get back to this after triage.
|
Actually this behavior seems intended: Lines 59 to 62 in a9b3e37
Making it default to ~/.cache when the given directory is not writable. I'm not sure it's a good idea, maybe the plugin could move its state directory to NOTE: as a workaround I'll just make sure the directory is created if it doesn't exist |
Yes I am already planning this zi#156 🙃 |
I am thinking about setting a global variable for cache: https://github.com/z-shell/zi/blob/82b6a194ca89f61765fc90456513d11ce6844788/zi.zsh#L58-L67 Which then can be adjusted for all plugins: https://z.digitalclouds.dev/docs/guides/customization#-customizing-paths |
@bew, check branch 25-cache, to test the behavior. 🤞 References: Lines 54 to 61 in 35d051c
zi wait'!' lucid for ver'25-cache' \
atinit"FAST_WORK_DIR=~/.cache/anyPath; zicompinit; zicdreplay" \
z-shell/F-SY-H Additionally |
gitstatus' bootstrap was auto-downloading its pre-compiled binary to a directory in ~/.cache, which is a tmpfs => empty on boot. Similarly fast-syntax-highlighting was saving which theme is selected in a directory in ~/.cache => empty on boot, so it was falling back on default theme. (also update this plugin, and point it to an updated fork)
#26 is working well, 👍 |
I'd argue though that what F-Sy-H puts in the cache dir is NOT just cache data that can be lost and not change anything for the user. Have you though about having the distinction (like XDG* spec) between cache / config / data / state ?
|
I will check this properly and let you know about what we can do |
Maybe you have tried this? P.S. I have started the |
Env:
OSTYPE=linux-gnu CPUTYPE=x86_64 MACHINE_TYPE=x86_64 ZSH_VERSION=5.8.1
a rapid check of the code seems to show that I could set the
FAST_WORK_DIR
to change where the state of FSH is stored, by trying that:Starting a new shell I get:
Which seems wrong...
In addition to that, it seems that the chroma system assumes the theme is stored in ~/.cache/fsh, and does not check what
FAST_WORK_DIR
is set to.I tried to fix that in #24, but further testing showed the weird inconsistency above.
The text was updated successfully, but these errors were encountered: