add more rigorous thumbnail checks
Submitted by Michael Chudobiak
Assigned to Desktop Maintainers
Link to original bug (#523028)
Description
It would be nice to replace:
gnome_thumbnail_factory_lookup gnome_thumbnail_factory_has_valid_failed_thumbnail gnome_thumbnail_factory_can_thumbnail gnome_thumbnail_factory_save_thumbnail gnome_thumbnail_factory_create_failed_thumbnail gnome_thumbnail_is_valid
with versions that:
[1] Replaced the "mtime" parameter with a GFileInfo parameter, to facilitate [2].
[2] Determined thumbnail freshness based on mtime, ctime, and file-size comparisons, instead of just mtime comparisons. The new ctime/file-size comparisons would only be made if the existing thumbnail had these parameters embedded as PNG text chunks, to stay compatible with http://people.freedesktop.org/~vuntz/thumbnail-spec-cache (or maybe we should regenerate these thumbnails, with the new data... not sure...)
Tightening up the thumbnail freshness checks would eliminate these issues:
a) Slow devices such as scanners or oscilloscopes on serial ports may write image files quite slowly. It can happen that a device writes an incomplete chunk at t = 10.1 seconds, and gnome creates a "failed" thumbnail associated with that filename+mtime. The device may then save the final bit of the file at t=10.4 seconds, but apps will still use the failed thumbnail. (gThumb avoids this problem by ignoring "failed" thumbnail if their mtime is less than 5 seconds old, bug 432759. I run into this issue when saving files from my RS-232-connected oscilloscope.)
b) If a user enters a folder with incorrect permissions, "failed" thumbnails will be generated. If the user then chmods the correct permissions, new thumbnails are not currently generated because only the ctime changes, not the mtime. For example, see bug 516125.
c) If you rapidly rename a batch of files with a shell script, you can end up with a new group of files that share some of the old file names and mtimes, but have different images. Obscure, but some users run into it - bug 522317.
This is all fairly simple to do, code-wise. The main point of contention is whether it is worth doing. I feel it would be nice to plug these holes, because gnome does not offer a simple gui method of purging the thumbnail cache. Advanced users can use rm ~/.thumbnails, of course, but that is not elegant.
- Mike