mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 14:36:16 +01:00
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: Chris Lamb <lamby@debian.org> https://bugzilla.gnome.org/show_bug.cgi?id=786983
This commit is contained in:
parent
2204034b9f
commit
e5eaca5492
@ -42,6 +42,7 @@ query_dir (const char *dirname)
|
|||||||
{
|
{
|
||||||
GString *data;
|
GString *data;
|
||||||
GDir *dir;
|
GDir *dir;
|
||||||
|
GList *list = NULL, *iterator = NULL;
|
||||||
const char *name;
|
const char *name;
|
||||||
char *cachename;
|
char *cachename;
|
||||||
char **(* query) (void);
|
char **(* query) (void);
|
||||||
@ -63,11 +64,16 @@ query_dir (const char *dirname)
|
|||||||
data = g_string_new ("");
|
data = g_string_new ("");
|
||||||
|
|
||||||
while ((name = g_dir_read_name (dir)))
|
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;
|
GModule *module;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
char **extension_points;
|
char **extension_points;
|
||||||
|
|
||||||
|
name = iterator->data;
|
||||||
if (!is_valid_module_name (name))
|
if (!is_valid_module_name (name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -100,6 +106,7 @@ query_dir (const char *dirname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_dir_close (dir);
|
g_dir_close (dir);
|
||||||
|
g_list_free_full (list, g_free);
|
||||||
|
|
||||||
cachename = g_build_filename (dirname, "giomodule.cache", NULL);
|
cachename = g_build_filename (dirname, "giomodule.cache", NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user