Commit e5eaca54 authored by Chris Lamb's avatar Chris Lamb Committed by Philip Withnall

gio-querymodules: Make the output reproducible

Whilst working on the Reproducible Builds effort [0], we noticed that
queryimmodules generates non-reproducible output as it iterates over the
filesystem without sorting.

Patch attached.

 [0] https://reproducible-builds.org/Signed-off-by: 's avatarChris Lamb <lamby@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=786983
parent 2204034b
......@@ -42,6 +42,7 @@ query_dir (const char *dirname)
{
GString *data;
GDir *dir;
GList *list = NULL, *iterator = NULL;
const char *name;
char *cachename;
char **(* query) (void);
......@@ -63,11 +64,16 @@ query_dir (const char *dirname)
data = g_string_new ("");
while ((name = g_dir_read_name (dir)))
list = g_list_prepend (list, g_strdup (name));
list = g_list_sort (list, (GCompareFunc) g_strcmp0);
for (iterator = list; iterator; iterator = iterator->next)
{
GModule *module;
gchar *path;
char **extension_points;
name = iterator->data;
if (!is_valid_module_name (name))
continue;
......@@ -100,6 +106,7 @@ query_dir (const char *dirname)
}
g_dir_close (dir);
g_list_free_full (list, g_free);
cachename = g_build_filename (dirname, "giomodule.cache", NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment