From: Naïm Favier Date: Tue, 16 Nov 2021 11:53:38 +0000 (+0100) Subject: composetable: invalidate cache based on symlink mtime too X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~5^2~141^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=22f523694393f2e4c5d26cdce6bcc1ee15c4185a;p=gtk4.git composetable: invalidate cache based on symlink mtime too When the compose file is a symbolic link, take the link itself's modification time into account (in addition to its target's) in determining whether to invalidate the compose cache. This is useful e.g. on NixOS systems where the compose file might point to a store path with an irrelevant modification time, and we want the cache to expire when the symlink itself changes. --- diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c index e7ed9d7474..7951b04c4d 100644 --- a/gtk/gtkcomposetable.c +++ b/gtk/gtkcomposetable.c @@ -755,8 +755,11 @@ gtk_compose_table_load_cache (const char *compose_file, if (!g_file_test (path, G_FILE_TEST_EXISTS)) goto out_load_cache; - g_stat (compose_file, &original_buf); g_stat (path, &cache_buf); + g_lstat (compose_file, &original_buf); + if (original_buf.st_mtime > cache_buf.st_mtime) + goto out_load_cache; + g_stat (compose_file, &original_buf); if (original_buf.st_mtime > cache_buf.st_mtime) goto out_load_cache; if (!g_file_get_contents (path, &contents, &total_length, &error))