agkozak / zsh-z

Jump quickly to directories that you have visited "frecently." A native Zsh port of z.sh with added features.
MIT License
2.02k stars 76 forks source link

Strange file created in home directory #63

Closed bound-variable closed 2 years ago

bound-variable commented 2 years ago

The variable ZSHZ_DATA is unset (at its default ~/.z).

I've had .z in my home directory. Its contents are populated with directories.

Today a new file was created in home: .z.19172. It's empty.

Output of ls -l .z*:

-rw-r--r-- 1 alan alan 1386 Mar 21 10:19 .z
-rw-r--r-- 1 alan alan    0 Mar 21 10:13 .z.19172
agkozak commented 2 years ago

Zsh-z follows rupa/z in employing temporary files like that -- .z. plus a random number. On rare occasions, the program gets interrupted and the temporary file is not removed.

You know what, though? There's no reason it shouldn't be keeping them in /tmp or TMPDIR. Let's leave this issue open -- in a couple of days I'll have time to make the necessary changes.

Thanks for bringing this matter up.

mafredri commented 2 years ago

One benefit for keeping the tempfiles beside .z is that they're very likely to be on the same filesystem which makes the mv atomic whereas moving from /tmp could result in a copy + write, at which point there's no guarantee the new write will succeed. It's pretty common for /tmp to be tmpfs (RAM) these days.

agkozak commented 2 years ago

Thanks as always, @mafredri. You must be right.