don't use ~/.cache for temporary files, use /var/tmp instead
I keep finding ~/.cache/.fr-randomstring
directories lying around from time to time. They occupy space (sometimes quite a lot, if the archives are large) and nothing ever cleans them up. On one of my PCs, I found even 10 years old temporary files from file-roller! This is a very suboptimal user experience.
(I think these directories only persist in certain circumstances, i.e. a cancelled operation or an error, and in a regular usage they do get cleaned up.)
There are several issues with this approach:
- Those directories are not cleaned up automatically. They occupy more and more space and the user is not aware of it.
- Those temporary files are hidden (first in
.cache
and then with.fr
), which means it's even harder to users to find them to recover free space. I personally do not expect any hidden files inside.cache/
, because it doesn't make any sense. - The
fr
identifier is very unhelpful to the user, it doesn't indicate the program which created them meaningfully to the user. The OSes are no longer limited to 8.3 filename length.
I believe this has a simple solution. The problem arises because file-roller uses ~/.cache
as a temporary directory, which it is not. Cache files are meant to speed up future execution of a program, save bandwidth, etc. Each program is supposed to maintain its cache directory on its own. And most programs do that, they create their own directory e.g. ~/.cache/evolution
or ~/.cache/gimp
and maintain it. File-roller creates completely random directories inside and doesn't care about them afterwards. It seems obvious that file-roller uses ~/.cache
in the spirit of /var/tmp
. Why doesn't it use /var/tmp
then?
If file-roller used /var/tmp
instead, no change in behavior is needed, because systemd-tmpfiles
clears those redundant directories after some time (usually 30 days). Also, that's were temporary files (and not cache files) properly belong.
If you don't agree with the approach above and insist on using ~/.cache
instead of /var/tmp
, can you please create ~/.cache/file-roller/
, perform all operations there, and clean the unneeded files as expected?
Thanks!
file-roller-43.0-1.fc37.x86_64
Fedora 37