Symlinks don't use target file's thumbnail
Because my home filesystem is so vast (I have over 150 000 documents), I have a ton of soft symbolic links linking back and forth so that I can't get "lost", as an images folder (or assets folder of some kind) might be relevant to multiple projects or contexts.
The way thumbnail filenames are generated in the Freedesktop specification is by using MD5 hashing of the whole URI of the file, and that hash is then suffixed by .png
and dumped into the appropriate (normal, large, etc.) folder of the XDG thumbnails cache directories. This is also I interpreted it in Pitivi a decade ago (in a much simpler codebase, because it's Python), such as in the get_asset_thumbnails_path
method that provided the full paths of the thumbnail files for the get_thumbnails_from_xdg_cache
method.
From observing the behavior and speed characteristics of Nautilus in practice, it seems to me like Nautilus is not taking symlinks into account when it comes to thumbnails, and generates thumbnails for every URI of every symlinked version, instead of first determining if the file (or folder, or its parent folders) is a symbolic link and following the symlink to determine the origin URI and then generating (and displaying) the thumbnail, only if there isn't already one, by using the origin URI to generate the hash of the thumbnail.
So if I have ten symlinked locations of a particular photo directory, every time I visit one of them, Nautilus will generate thumbnails from scratch, instead of reusing/sharing thumbnails.
Reusing those thumbnails would be an order of magnitude faster (instantaneous), use much less power, and reduce disk usage (and thumbnail cache churn). It would be a good complementary solution to #856 (closed). In my view, it's "just" a matter of always resolving symlinks first before determining the full URI for a file to determine the thumbnail's filename, therefore eliminating duplication.
In theory, one can wonder to which extent Nautilus does work behind the scenes to figure out which thumbnail pixbuf to show for which file, whether this is glib or some other library (if those libraries even handle the hashes/paths/etc. for apps' use, and if they do so with awareness of symlinks), but my hunch really is that this sort of optimization is pretty much the app's (Nautilus') territory, so filing it here at least for investigation.