[glib] gio-querymodules: Make the output reproducible
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gio-querymodules: Make the output reproducible
- Date: Fri, 8 Sep 2017 14:20:50 +0000 (UTC)
commit e5eaca5492d3e08d7d955e475cb4607a2d0fff61
Author: Chris Lamb <lamby debian org>
Date: Tue Aug 29 16:59:56 2017 +0100
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
gio/gio-querymodules.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gio/gio-querymodules.c b/gio/gio-querymodules.c
index 667336a..7abfe07 100644
--- a/gio/gio-querymodules.c
+++ b/gio/gio-querymodules.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]