Source: gtk+3.0
Version: 3.22.21-1
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: toolchain filesystemordering
X-Debbugs-Cc: [email protected]
Hi,
Whilst working on the Reproducible Builds effort [0], we noticed
that gtk+3.0's queryimmodules generates non-reproducible output
as it iterates over the filesystem without sorting.
(NB. This is the GTK3 version of #872729. It was found whilst testing
the Tails [1] ISO for reproducibility issues.)
Patch attached.
[0] https://reproducible-builds.org/
[1] https://tails.boum.org/
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/gtk/queryimmodules.c b/gtk/queryimmodules.c
index e9978fd..96b64c7 100644
--- a/gtk/queryimmodules.c
+++ b/gtk/queryimmodules.c
@@ -200,13 +200,19 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (dir)
{
const char *dent;
+ GList *list = NULL, *iterator = NULL;
while ((dent = g_dir_read_name (dir)))
+ list = g_list_prepend (list, g_strdup (dent));
+
+ list = g_list_sort (list, (GCompareFunc) strcmp);
+ for (iterator = list; iterator; iterator = iterator->next)
{
- if (g_str_has_suffix (dent, SOEXT))
- error |= query_module (dirs[i], dent, contents);
+ if (g_str_has_suffix (iterator->data, SOEXT))
+ error |= query_module (dirs[i], iterator->data,
contents);
}
+ g_list_free_full (list, g_free);
g_dir_close (dir);
}