summary refs log tree commit diff
path: root/gnu/packages/patches/gdk-pixbuf-list-dir.patch
blob: 137914a19c9c7dd5f5fcc4db6e886ad7a0535081 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Sort directory entries so that the output of
‘gdk-pixbuf-query-loaders’ is deterministic.

See: https://bugzilla.gnome.org/show_bug.cgi?id=777332
--- gdk-pixbuf-2.34.0/gdk-pixbuf/queryloaders.c.orig	2017-01-11 00:17:32.865843062 +0100
+++ gdk-pixbuf-2.34.0/gdk-pixbuf/queryloaders.c	2017-01-16 16:12:03.420667874 +0100
@@ -354,16 +354,27 @@
 
                 dir = g_dir_open (path, 0, NULL);
                 if (dir) {
+                        GList *entries = NULL;
                         const char *dent;
 
                         while ((dent = g_dir_read_name (dir))) {
                                 gint len = strlen (dent);
                                 if (len > SOEXT_LEN &&
                                     strcmp (dent + len - SOEXT_LEN, SOEXT) == 0) {
-                                        query_module (contents, path, dent);
+                                        entries = g_list_append (entries, g_strdup (dent));
                                 }
                         }
                         g_dir_close (dir);
+                        /* Sort directory entries so that the output of
+                           ‘gdk-pixbuf-query-loaders’ is deterministic. */
+                        entries = g_list_sort (entries, (GCompareFunc) strcmp);
+                        GList *xentries;
+                        for (xentries = entries; xentries; xentries = g_list_next (xentries)) {
+                                dent = xentries->data;
+                                query_module (contents, path, dent);
+                                g_free (xentries->data);
+                        }
+                        g_list_free (entries);
                 }
 #else
                 g_string_append_printf (contents, "# dynamic loading of modules not supported\n");