agkozak/zsh-z

Strange file created in home directory

Closed this issue · 3 comments

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

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.

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.

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