z icon indicating copy to clipboard operation
z copied to clipboard

cached Z_DATA path not portable

Open ckoehler opened this issue 3 years ago • 4 comments

Sorry if this is not a z issue, but a fish thing. I am new to both.

In z.fish, it sets Z_DATA and some other vars that include the $HOME directory. Unfortunately, $HOME is different for me on different machines, so I get errors when Z_DATA points to the data path of another machine.

Any way to fix that? Is it a fish thing? Thanks!

ckoehler avatar Jul 14 '21 03:07 ckoehler

I think you are referring to setting some universal variables, which get written to ~/.config/fish_variables, like this:

SETUVAR Z_DATA:/home/mark/\x2elocal/share/z/data
SETUVAR Z_DATA_DIR:/home/mark/\x2elocal/share/z

The code says it only sets those universal variables of Z_DATA is not set. It uses if test -z "$Z_DATA". According to man test, this is checking if Z_DATA is zero-length or not.

https://github.com/jethrokuan/z/blob/master/conf.d/z.fish

So the solution is set Z_DATA on both of your machines with different values.

The document already recommends setting Z_DATA explicily: https://github.com/jethrokuan/z/blob/master/man/man1/z.md#configuration)https://github.com/jethrokuan/z/blob/master/man/man1/z.md#configuration

markstos avatar Apr 05 '22 13:04 markstos

Uhm... this means we should set Z_DATA explicitly to the home path value in every machine... something that should be the default actually. Doesn't sound very clean.

Also, I can't see where the documentation "recommends" to set Z_DATA explicitly -- perhaps it has been edited in the meanwhile?

For reference, Fisher itself fixed this very issue here, so IMHO a similar approach could be considered.

lorthirk avatar Jul 04 '22 16:07 lorthirk

Here's my workaround for this: https://github.com/itsfarseen/dotfiles/blob/3df373b321e8f240eaba169611bfe9adab86c514/config/fish/conf.d/_z-make-portable.fish

More context: https://github.com/jorgebucaran/fisher/pull/746

itsfarseen avatar Mar 29 '24 18:03 itsfarseen

I think this issue can be closed. Multiple comments have documented solutions that don't require modifying the code here.

markstos avatar Mar 31 '24 21:03 markstos