summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2018-08-15 03:11:21 +0200
committerEmmanuele Bassi <ebassi@gnome.org>2021-03-13 15:12:18 +0000
commit850768270f86f060ad317933b629593f6fdd08be (patch)
tree8457db120af6fdc654a8b607d1b9b3280edf2ccd
parentc7df3b9e9790012e6c5fbad6a4f4519bcf75561f (diff)
downloadgtk+-ebassi/reproducible-icon-cache.tar.gz
updateiconcache: Sort list of entriesebassi/reproducible-icon-cache
because filesystem readdir order is indeterministic. Without this patch, building openSUSE's balsa package had variations between builds in /usr/share/balsa/icon-theme.cache (cherry picked from commit b364827a5b99e3b02862f36be4c03826e72aefba) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--gtk/updateiconcache.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c
index b48eaca804..6703c8b9e8 100644
--- a/gtk/updateiconcache.c
+++ b/gtk/updateiconcache.c
@@ -600,6 +600,7 @@ scan_directory (const gchar *base_path,
{
GHashTable *dir_hash;
GDir *dir;
+ GList *list = NULL, *iterator = NULL;
const gchar *name;
gchar *dir_path;
gboolean dir_added = FALSE;
@@ -617,6 +618,13 @@ scan_directory (const gchar *base_path,
while ((name = g_dir_read_name (dir)))
{
+ list = g_list_prepend (list, g_strdup (name));
+ }
+ list = g_list_sort (list, (GCompareFunc) strcmp);
+ for (iterator = list; iterator; iterator = iterator->next)
+ {
+ name = iterator->data;
+
gchar *path;
gboolean retval;
int flags = 0;
@@ -695,6 +703,7 @@ scan_directory (const gchar *base_path,
g_free (path);
}
+ g_list_free_full (list, g_free);
g_dir_close (dir);
/* Move dir into the big file hash */