Skip to content

Commit

Permalink
src/ibuscomposetable: invalidate cache based on symlink mtime too
Browse files Browse the repository at this point in the history
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.

BUG=#2362
  • Loading branch information
ncfavier committed Nov 17, 2021
1 parent d53d31d commit cfcc6f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ibuscomposetable.c
Expand Up @@ -1040,10 +1040,14 @@ ibus_compose_table_load_cache (const gchar *compose_file)
if (!g_file_test (path, G_FILE_TEST_EXISTS))
break;

if (g_stat (compose_file, &original_buf))
break;
if (g_stat (path, &cache_buf))
break;
if (g_lstat (compose_file, &original_buf))
break;
if (original_buf.st_mtime > cache_buf.st_mtime)
break;
if (g_stat (compose_file, &original_buf))
break;
if (original_buf.st_mtime > cache_buf.st_mtime)
break;
if (!g_file_get_contents (path, &contents, &length, &error)) {
Expand Down

0 comments on commit cfcc6f1

Please sign in to comment.