Apply patches on new upstream 2.74.5

This commit is contained in:
su-fang 2023-02-15 09:31:22 +08:00
parent 72997377d8
commit 15cd5c07b0
21 changed files with 0 additions and 8744 deletions

View File

@ -1,38 +0,0 @@
From: Ryan Lortie <desrt@desrt.ca>
Date: Tue, 4 Mar 2014 09:20:38 -0500
Subject: timer test: use 'volatile' for locals
GCC seems to be failing to follow the letter of the C spec by allowing extra
precision in floating point values to persist across assignments which are
optimised away.
Force its hand by using 'volatile' on the locals in question.
Bug: https://gitlab.gnome.org/GNOME/glib/issues/820
Forwarded: yes
---
glib/tests/timer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/glib/tests/timer.c b/glib/tests/timer.c
index 149b3af..b7a90c2 100644
--- a/glib/tests/timer.c
+++ b/glib/tests/timer.c
@@ -30,7 +30,7 @@ static void
test_timer_basic (void)
{
GTimer *timer;
- gdouble elapsed;
+ volatile gdouble elapsed;
gulong micros;
timer = g_timer_new ();
@@ -47,7 +47,7 @@ static void
test_timer_stop (void)
{
GTimer *timer;
- gdouble elapsed, elapsed2;
+ volatile gdouble elapsed, elapsed2;
timer = g_timer_new ();

View File

@ -1,168 +0,0 @@
From: Philip Withnall <withnall@endlessm.com>
Date: Thu, 23 Nov 2017 18:48:58 +0000
Subject: [PATCH] Call gettext if .desktop file does not have inline
translations
Patch from OpenSUSE via Ubuntu, original author unknown. Martin Pitt and
Vincent Untz appear to be the main authors.
Reworked slightly by Philip Withnall to avoid exposing new public API
for the non-standard keys.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=569829
Bug-Ubuntu: https://launchpad.net/bugs/3935
Applied-upstream: no, rejected because "this will be solved soon" (in 2013)
---
glib/gkeyfile.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+)
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index dc80ce5..661c2ed 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -488,6 +488,17 @@
* Since: 2.14
*/
+/* Downstream Debian defines for calling gettext() if a .desktop file doesnt
+ * contain translations. These are not standardised.
+ *
+ * See: https://launchpad.net/bugs/3935
+ * See:http://bugzilla.gnome.org/show_bug.cgi?id=569829
+ */
+#define G_KEY_FILE_DESKTOP_ACTION_GROUP_PREFIX "Desktop Action"
+#define G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN "X-GNOME-Gettext-Domain"
+#define G_KEY_FILE_DESKTOP_KEY_FULLNAME "X-GNOME-FullName"
+#define G_KEY_FILE_DESKTOP_KEY_KEYWORDS "Keywords"
+
typedef struct _GKeyFileGroup GKeyFileGroup;
/**
@@ -511,6 +522,7 @@ struct _GKeyFile
GKeyFileFlags flags;
gchar **locales;
+ gchar *gettext_domain;
volatile gint ref_count;
};
@@ -636,6 +648,7 @@ g_key_file_init (GKeyFile *key_file)
key_file->list_separator = ';';
key_file->flags = 0;
key_file->locales = g_strdupv ((gchar **)g_get_language_names ());
+ key_file->gettext_domain = NULL;
}
static void
@@ -655,6 +668,12 @@ g_key_file_clear (GKeyFile *key_file)
key_file->parse_buffer = NULL;
}
+ if (key_file->gettext_domain)
+ {
+ g_free (key_file->gettext_domain);
+ key_file->gettext_domain = NULL;
+ }
+
tmp = key_file->groups;
while (tmp != NULL)
{
@@ -874,6 +893,11 @@ g_key_file_load_from_fd (GKeyFile *key_file,
return FALSE;
}
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
+ NULL);
+
return TRUE;
}
@@ -986,6 +1010,11 @@ g_key_file_load_from_data (GKeyFile *key_file,
return FALSE;
}
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
+ NULL);
+
return TRUE;
}
@@ -2213,6 +2242,8 @@ g_key_file_get_locale_string (GKeyFile *key_file,
GError *key_file_error;
gchar **languages;
gboolean free_languages = FALSE;
+ gboolean try_gettext = FALSE;
+ const gchar *msg_locale;
gint i;
g_return_val_if_fail (key_file != NULL, NULL);
@@ -2234,6 +2265,25 @@ g_key_file_get_locale_string (GKeyFile *key_file,
free_languages = FALSE;
}
+ /* we're only interested in gettext translation if we don't have a
+ * translation in the .desktop file itself and if the key is one of the keys
+ * we know we want to translate: Name, GenericName, Comment, Keywords.
+ * Blindly doing this for all keys can give strange result for the icons,
+ * since the Icon is a locale string in the spec, eg. We also only get
+ * translation in the mo file if the requested locale is the LC_MESSAGES one.
+ * Ideally, we should do more and change LC_MESSAGES to use the requested
+ * locale, but there's no guarantee it's installed on the system and it might
+ * have some side-effects. Since this is a corner case, let's ignore it. */
+ msg_locale = setlocale (LC_MESSAGES, NULL);
+ try_gettext = msg_locale && key_file->gettext_domain &&
+ (strcmp (group_name, G_KEY_FILE_DESKTOP_GROUP) == 0 ||
+ g_str_has_prefix (group_name, G_KEY_FILE_DESKTOP_ACTION_GROUP_PREFIX)) &&
+ (strcmp (key, G_KEY_FILE_DESKTOP_KEY_NAME) == 0 ||
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_FULLNAME) == 0 ||
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME) == 0 ||
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_KEYWORDS) == 0 ||
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_COMMENT) == 0);
+
for (i = 0; languages[i]; i++)
{
candidate_key = g_strdup_printf ("%s[%s]", key, languages[i]);
@@ -2250,6 +2300,39 @@ g_key_file_get_locale_string (GKeyFile *key_file,
translated_value = NULL;
}
+ /* Fallback to gettext */
+ if (try_gettext && !translated_value)
+ {
+ gchar *orig_value = g_key_file_get_string (key_file, group_name, key, NULL);
+
+ if (orig_value)
+ {
+ gboolean codeset_set;
+ const gchar *translated;
+ gboolean has_gettext;
+
+ codeset_set = bind_textdomain_codeset (key_file->gettext_domain, "UTF-8") != NULL;
+ translated = NULL;
+
+ translated = g_dgettext (key_file->gettext_domain,
+ orig_value);
+ has_gettext = translated != orig_value;
+
+ g_free (orig_value);
+
+ if (has_gettext)
+ {
+ if (codeset_set)
+ translated_value = g_strdup (translated);
+ else
+ translated_value = g_locale_to_utf8 (translated,
+ -1, NULL, NULL, NULL);
+ }
+ else
+ translated_value = NULL;
+ }
+ }
+
/* Fallback to untranslated key
*/
if (!translated_value)

View File

@ -1,135 +0,0 @@
From: Debian GNOME Maintainers
<pkg-gnome-maintainers@lists.alioth.debian.org>
Date: Wed, 29 Jun 2022 08:02:49 +0000
Subject: file-type
===================================================================
---
gio/gfile.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
po/zh_CN.po | 3 +++
2 files changed, 73 insertions(+)
diff --git a/gio/gfile.c b/gio/gfile.c
index a2ded14..e37bc36 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -39,6 +39,9 @@
#include <string.h>
#include <sys/types.h>
+#include <mntent.h>
+#include <sys/vfs.h>
+#include <syslog.h>
#include "gfile.h"
#include "glib/gstdio.h"
@@ -339,6 +342,29 @@ static gboolean g_file_real_measure_disk_usage_finish (GFile
guint64 *num_files,
GError **error);
+static const char* get_fs_type (char* path)
+{
+ const char* fs_type = NULL;
+ struct mntent* m = NULL;
+ FILE* f = NULL;
+
+ f = setmntent ("/etc/mtab", "r");
+ if (!f) {
+ syslog (LOG_ERR, "error:%s", strerror(errno));
+ }
+
+ while ((m = getmntent(f))) {
+ if (!path) continue;
+ if (!m->mnt_dir) continue;
+ if (!strcmp (path, m->mnt_dir)) {
+ fs_type = g_strdup_printf("%s", m->mnt_type);
+ }
+ }
+ endmntent (f);
+
+ return fs_type;
+}
+
typedef GFileIface GFileInterface;
G_DEFINE_INTERFACE (GFile, g_file, G_TYPE_OBJECT)
@@ -3457,10 +3483,32 @@ g_file_copy (GFile *source,
GFileIface *iface;
GError *my_error;
gboolean res;
+ const char* fs_type;
+ GMount* destination_mount;
+ GFile* root;
+ struct stat s;
g_return_val_if_fail (G_IS_FILE (source), FALSE);
g_return_val_if_fail (G_IS_FILE (destination), FALSE);
+ destination_mount = g_file_find_enclosing_mount(g_file_get_parent(destination), NULL, NULL);
+ if ( destination_mount != NULL) {
+ root = g_mount_get_default_location (destination_mount);
+ fs_type = get_fs_type (g_file_get_path(root));
+ if(fs_type != NULL) {
+ if(!strcmp(fs_type,"vfat") || !strcmp(fs_type,"fat32")) {
+ if (stat(g_file_get_path(source), &s) == 0) {
+ if(s.st_size > 4294967296) {
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("The file is too large, the fat format file system only supports files within 4G,can be imported in device after compression"));
+ return FALSE;
+ }
+ }
+ }
+
+ g_free(fs_type);
+ }
+ }
+
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
@@ -3659,10 +3707,32 @@ g_file_move (GFile *source,
GFileIface *iface;
GError *my_error;
gboolean res;
+ const char* fs_type;
+ GMount* destination_mount;
+ GFile* root;
+ struct stat s;
g_return_val_if_fail (G_IS_FILE (source), FALSE);
g_return_val_if_fail (G_IS_FILE (destination), FALSE);
+ destination_mount = g_file_find_enclosing_mount(g_file_get_parent(destination), NULL, NULL);
+ if ( destination_mount != NULL) {
+ root = g_mount_get_default_location (destination_mount);
+
+ fs_type = get_fs_type (g_file_get_path(root));
+ if(fs_type != NULL) {
+ if(!strcmp(fs_type,"vfat") || !strcmp(fs_type,"fat32")) {
+ if (stat(g_file_get_path(source), &s) == 0) {
+ if(s.st_size > 4294967296) {
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("The file is too large, the fat format file system only supports files within 4G,can be moved in device after compression"));
+ return FALSE;
+ }
+ }
+ }
+ g_free(fs_type);
+ }
+ }
+
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 4e4adb5..1a46756 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -43,6 +43,9 @@ msgstr "GApplication 选项"
msgid "Show GApplication options"
msgstr "显示 GApplication 选项"
+msgid "The file is too large, the fat format file system only supports files within 4G,can be imported in device after compression"
+msgstr "文件太大fat格式文件系统只支持4G以内的文件压缩后可以导入设备"
+
#: ../gio/gapplication.c:538
msgid "Enter GApplication service mode (use from D-Bus service files)"
msgstr "进入 GApplication 服务模式(从 D-Bus 服务文件中调用)"

View File

@ -1,41 +0,0 @@
From: Debian GNOME Maintainers
<pkg-gnome-maintainers@lists.alioth.debian.org>
Date: Wed, 29 Jun 2022 08:02:49 +0000
Subject: fix-trash-issue-in-data-usershare
===================================================================
---
gio/glocalfile.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 72ef947..bb7c863 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1951,6 +1951,7 @@ g_local_file_trash (GFile *file,
GVfsClass *class;
GVfs *vfs;
int errsv;
+ gboolean is_local_file_in_usershare = FALSE;
if (glib_should_use_portal ())
return g_trash_portal_trash_file (file, error);
@@ -1988,7 +1989,8 @@ g_local_file_trash (GFile *file,
g_free (path);
}
- if (file_stat.st_dev == home_stat.st_dev)
+ is_local_file_in_usershare = g_str_has_prefix(local->filename, "/data/usershare");
+ if (file_stat.st_dev == home_stat.st_dev && !is_local_file_in_usershare)
{
is_homedir_trash = TRUE;
errno = 0;
@@ -2028,7 +2030,7 @@ g_local_file_trash (GFile *file,
}
mount = g_unix_mount_at (topdir, NULL);
- if (mount == NULL || g_unix_mount_is_system_internal (mount))
+ if (mount == NULL || g_unix_mount_is_system_internal (mount) && !is_local_file_in_usershare)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Trashing on system internal mounts is not supported"));

View File

@ -1,51 +0,0 @@
From: Martin Pitt <mpitt@debian.org>
Date: Tue, 24 Feb 2009 16:08:05 +0100
Subject: Provide backwards compatibility for 01_gettext-desktopfiles.patch
for X-{Debian,Ubuntu}-Gettext-Domain
Ubuntu-specific. 01_gettext-desktopfiles.patch was changed to use
X-GNOME-, so this is necessary until all our .desktop files are converted.
Forwarded: no
---
glib/gkeyfile.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index 661c2ed..749254e 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -897,6 +897,16 @@ g_key_file_load_from_fd (GKeyFile *key_file,
G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
NULL);
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ "X-Ubuntu-Gettext-Domain",
+ NULL);
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ "X-Debian-Gettext-Domain",
+ NULL);
return TRUE;
}
@@ -1014,6 +1024,16 @@ g_key_file_load_from_data (GKeyFile *key_file,
G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
NULL);
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ "X-Ubuntu-Gettext-Domain",
+ NULL);
+ if (!key_file->gettext_domain)
+ key_file->gettext_domain = g_key_file_get_string (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ "X-Debian-Gettext-Domain",
+ NULL);
return TRUE;
}

View File

@ -1,36 +0,0 @@
From: Iain Lane <iain.lane@canonical.com>
Date: Mon, 10 Sep 2012 16:25:18 +0100
Subject: Disable confusing (to users) warning about deprecated schema paths
Disable a warning when compiling schemas which are installed
into 'deprecated' locations. Users see this very often due to
glib-compile-schemas being called from libglib2.0-0's trigger and it is
not very useful for them.
Forwarded: not-needed
---
gio/glib-compile-schemas.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
index 7888120..4c4d22e 100644
--- a/gio/glib-compile-schemas.c
+++ b/gio/glib-compile-schemas.c
@@ -1232,6 +1232,9 @@ parse_state_start_schema (ParseState *state,
return;
}
+ // Disable this warning: it confuses users and there is unlikely to be much
+ // progress towards fixing
+ /*
if (path && (g_str_has_prefix (path, "/apps/") ||
g_str_has_prefix (path, "/desktop/") ||
g_str_has_prefix (path, "/system/")))
@@ -1244,6 +1247,7 @@ parse_state_start_schema (ParseState *state,
g_printerr ("%s\n", message);
g_free (message);
}
+ */
state->schema_state = schema_state_new (path, gettext_domain,
extends, extends_name, list_of);

View File

@ -1,33 +0,0 @@
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Tue, 26 Jun 2012 19:28:14 +0200
Subject: Do not fail the /thread/thread4 test if prlimit() fails
This happens on the Debian buildds.
[smcv: Use g_test_skip()]
Forwarded: no, Debian buildd specific
---
glib/tests/thread.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/glib/tests/thread.c b/glib/tests/thread.c
index 579ce1f..3f1959d 100644
--- a/glib/tests/thread.c
+++ b/glib/tests/thread.c
@@ -142,7 +142,14 @@ test_thread4 (void)
nl.rlim_cur = 1;
if ((ret = prlimit (getpid (), RLIMIT_NPROC, &nl, &ol)) != 0)
- g_error ("prlimit failed: %s", g_strerror (errno));
+ {
+ gchar *message = g_strdup_printf ("setting PRLIMIT_NPROC to {cur=%d,max=%d} failed: %s",
+ (int) nl.rlim_cur, (int) nl.rlim_max,
+ g_strerror (errno));
+ g_test_skip (message);
+ g_free (message);
+ return;
+ }
error = NULL;
thread = g_thread_try_new ("a", thread1_func, NULL, &error);

View File

@ -1,25 +0,0 @@
From: =?utf-8?q?Sebastian_Dr=C3=B6ge?= <slomo@debian.org>
Date: Tue, 13 Jul 2010 14:06:28 +0200
Subject: Adjust path to glib-compile-schemas in the pkg-config file
This is because gio-querymodules and glib-compile-schemas have been put in
a private, versioned directory in libglib2.0-0 to avoid a dependency loop.
Forwarded: not-needed, specific to Debian packaging
---
gio/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/meson.build b/gio/meson.build
index 2ef60ed..32b47df 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -822,7 +822,7 @@ pkg.generate(libgio,
'giomoduledir=' + pkgconfig_giomodulesdir,
'gio=' + join_paths('${bindir}', 'gio'),
'gio_querymodules=' + join_paths('${bindir}', 'gio-querymodules'),
- 'glib_compile_schemas=' + join_paths('${bindir}', 'glib-compile-schemas'),
+ 'glib_compile_schemas=' + join_paths('${libdir}', 'glib-2.0', 'glib-compile-schemas'),
'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'),
'gdbus=' + join_paths('${bindir}', 'gdbus'),
'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'),

View File

@ -1,70 +0,0 @@
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Thu, 27 Sep 2012 11:22:56 +0200
Subject: Disable some tests on slow architectures which keep failing the
tests
[smcv: Modified to use g_test_skip() instead of omitting those test cases
completely, and allow them to be re-enabled with a Debian-specific
environment variable]
Co-authored-by: Simon McVittie <smcv@debian.org>
Forwarded: no
---
glib/tests/mainloop.c | 16 ++++++++++++++++
glib/tests/timeout.c | 9 +++++++++
2 files changed, 25 insertions(+)
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index 1368e9b..2c11d34 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -461,6 +461,14 @@ test_child_sources (void)
GMainLoop *loop;
GSource *parent, *child_b, *child_c, *end;
+#if defined(__arm__)
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_test_skip ("Not reliable on older ARM hardware");
+ return;
+ }
+#endif
+
ctx = g_main_context_new ();
loop = g_main_loop_new (ctx, FALSE);
@@ -539,6 +547,14 @@ test_recursive_child_sources (void)
GMainLoop *loop;
GSource *parent, *child_b, *child_c, *end;
+#if defined(__arm__)
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_test_skip ("Not reliable on older ARM hardware");
+ return;
+ }
+#endif
+
ctx = g_main_context_new ();
loop = g_main_loop_new (ctx, FALSE);
diff --git a/glib/tests/timeout.c b/glib/tests/timeout.c
index 47f00ba..d6fad36 100644
--- a/glib/tests/timeout.c
+++ b/glib/tests/timeout.c
@@ -175,6 +175,15 @@ test_func (gpointer data)
static void
test_rounding (void)
{
+
+#if defined(__arm__)
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_test_skip ("Not reliable on older ARM hardware");
+ return;
+ }
+#endif
+
loop = g_main_loop_new (NULL, FALSE);
last_time = g_get_monotonic_time ();

View File

@ -1,32 +0,0 @@
From: Iain Lane <laney@debian.org>
Date: Tue, 18 Mar 2014 15:43:35 +0000
Subject: Skip test which performs some unreliable floating point comparisons
[smcv: Modified to use g_test_skip() instead of omitting those test cases
completely, and allow them to be re-enabled with a Debian-specific
environment variable]
Co-authored-by: Simon McVittie <smcv@debian.org>
Bug: https://gitlab.gnome.org/GNOME/glib/issues/820
Forwarded: no
---
glib/tests/timer.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/glib/tests/timer.c b/glib/tests/timer.c
index b7a90c2..98e82da 100644
--- a/glib/tests/timer.c
+++ b/glib/tests/timer.c
@@ -33,6 +33,12 @@ test_timer_basic (void)
volatile gdouble elapsed;
gulong micros;
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_test_skip ("Not reliable due to floating-point rounding (glib#820)");
+ return;
+ }
+
timer = g_timer_new ();
elapsed = g_timer_elapsed (timer, &micros);

View File

@ -1,48 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Fri, 4 Jan 2019 08:37:20 +0000
Subject: Skip unreliable gdbus-threading tests by default
test_threaded_singleton() test to reproduce a race condition between
last-unref of the global singleton GDBusConnection and g_bus_get_sync().
test_method_calls_in_thread() checks that multiple threads can all make
method calls to the same proxy.
However, test setup intermittently times out with:
# GLib-GIO-DEBUG: run 0: refcount is 2, sleeping
Bail out! GLib-GIO-FATAL-ERROR: connection had too many refs
The current theory upstream is that this might be a reference leak in
test_delivery_in_thread().
Furthermore, test teardown is now often failing when destroying the test
bus.
Demote these tests to be run as part of the "flaky" autopkgtests, but
not at build time or in the part of the autopkgtest run that gates
progress into testing.
Bug: https://gitlab.gnome.org/GNOME/glib/issues/1515
Forwarded: no
---
gio/tests/gdbus-threading.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c
index 2b89fb0..2cc5757 100644
--- a/gio/tests/gdbus-threading.c
+++ b/gio/tests/gdbus-threading.c
@@ -649,6 +649,12 @@ main (int argc,
g_test_init (&argc, &argv, NULL);
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_print("ok 1 # SKIP all gdbus-threading tests skipped because they are too unreliable (glib#1515)\n");
+ return 77;
+ }
+
session_bus_up ();
/* this is safe; testserver will exit once the bus goes away */

View File

@ -1,37 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Thu, 3 Jan 2019 09:01:03 +0000
Subject: closures test: Skip on arm* unless flaky tests are allowed
Choosing the right number of iterations to avoid either taking literally
hours on some hardware, or getting spurious failures when one thread
starves another, seems to be too hard to get right in practice.
Make this test opt-in so that its failures aren't release-critical.
We can run it as a separate autopkgtest that is marked flaky.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/880883
Bug-Debian: https://bugs.debian.org/917983
Forwarded: not-needed
---
gobject/tests/closure-refcount.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gobject/tests/closure-refcount.c b/gobject/tests/closure-refcount.c
index 5a92005..73185f0 100644
--- a/gobject/tests/closure-refcount.c
+++ b/gobject/tests/closure-refcount.c
@@ -260,6 +260,14 @@ test_closure_refcount (void)
GTest *object;
guint i, n_iterations;
+#if defined(__aarch64__) || defined(__arm__)
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") != NULL)
+ {
+ g_print ("SKIP: Test is known to be flaky on arm* (#880883, #917983)\n");
+ return 0;
+ }
+#endif
+
object = g_object_new (G_TYPE_TEST, NULL);
closure = g_cclosure_new (G_CALLBACK (test_signal_handler), &test_data, destroy_data);

View File

@ -1,30 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Fri, 26 Jul 2019 23:49:03 +0100
Subject: gmenumodel test: Mark as flaky
This test has not had a great history of reliability.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/932678
Forwarded: no
---
gio/tests/gmenumodel.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gio/tests/gmenumodel.c b/gio/tests/gmenumodel.c
index fc0fcea..5c54551 100644
--- a/gio/tests/gmenumodel.c
+++ b/gio/tests/gmenumodel.c
@@ -1147,6 +1147,12 @@ test_dbus_peer_subscriptions (void)
{
PeerConnection peer;
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_test_skip ("Not reliable? #932678");
+ return;
+ }
+
peer_connection_up (&peer);
do_subscriptions (peer.server_connection, peer.client_connection);
peer_connection_down (&peer);

View File

@ -1,36 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Fri, 26 Jul 2019 23:51:39 +0100
Subject: gvariant test: Don't run at build-time on mips
DEB_ALLOW_FLAKY_TESTS is not quite right here, because we don't know
that the test would fail if left for long enough - the problem is that
it doesn't get there, because generating random floating-point numbers
is very slow on some of our mips hardware. However, it has the right
practical effect.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.debian.org/932678
Forwarded: no
---
glib/tests/gvariant.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 3905e20..d418c75 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -2405,6 +2405,14 @@ test_fuzzes (gpointer data)
gdouble fuzziness;
int i;
+#ifdef __mips__
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_test_skip ("Extremely slow on some mips CPUs: #932678");
+ return;
+ }
+#endif
+
fuzziness = GPOINTER_TO_INT (data) / 100.;
for (i = 0; i < 200; i++)

View File

@ -1,24 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Wed, 30 Oct 2019 08:44:52 +0000
Subject: taptestrunner: Stop looking like an executable script
This file is installed as non-executable but starts with the #! that
indicates an executable script, causing warnings from Debian's Lintian
tool. In fact it is imported as a Python module rather than being run
as an executable, so there is no need for the #! line.
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: no
---
gobject/tests/taptestrunner.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/gobject/tests/taptestrunner.py b/gobject/tests/taptestrunner.py
index 2614961..7baceb5 100644
--- a/gobject/tests/taptestrunner.py
+++ b/gobject/tests/taptestrunner.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# coding=utf-8
# Copyright (c) 2015 Remko Tronçon (https://el-tramo.be)

View File

@ -1,106 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Tue, 25 Feb 2020 10:45:07 +0000
Subject: testfilemonitor: Skip if we are avoiding flaky tests
See https://gitlab.gnome.org/GNOME/glib/issues/1634
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: no
---
gio/tests/testfilemonitor.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/gio/tests/testfilemonitor.c b/gio/tests/testfilemonitor.c
index b74dc2b..79b5776 100644
--- a/gio/tests/testfilemonitor.c
+++ b/gio/tests/testfilemonitor.c
@@ -21,6 +21,12 @@ setup (Fixture *fixture,
gchar *path = NULL;
GError *local_error = NULL;
+ if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+ {
+ g_test_skip ("https://gitlab.gnome.org/GNOME/glib/issues/1634");
+ return;
+ }
+
path = g_dir_make_tmp ("gio-test-testfilemonitor_XXXXXX", &local_error);
g_assert_no_error (local_error);
@@ -37,7 +43,9 @@ teardown (Fixture *fixture,
{
GError *local_error = NULL;
- g_file_delete (fixture->tmp_dir, NULL, &local_error);
+ if (fixture->tmp_dir != NULL)
+ g_file_delete (fixture->tmp_dir, NULL, &local_error);
+
g_assert_no_error (local_error);
g_clear_object (&fixture->tmp_dir);
}
@@ -360,6 +368,10 @@ test_atomic_replace (Fixture *fixture,
GError *error = NULL;
TestData data;
+ /* respect g_test_skip() during setup() */
+ if (g_test_failed ())
+ return;
+
data.step = 0;
data.events = NULL;
@@ -465,6 +477,10 @@ test_file_changes (Fixture *fixture,
GError *error = NULL;
TestData data;
+ /* respect g_test_skip() during setup() */
+ if (g_test_failed ())
+ return;
+
data.step = 0;
data.events = NULL;
@@ -582,6 +598,10 @@ test_dir_monitor (Fixture *fixture,
GError *error = NULL;
TestData data;
+ /* respect g_test_skip() during setup() */
+ if (g_test_failed ())
+ return;
+
data.step = 0;
data.events = NULL;
@@ -679,6 +699,10 @@ test_dir_non_existent (Fixture *fixture,
TestData data;
GError *error = NULL;
+ /* respect g_test_skip() during setup() */
+ if (g_test_failed ())
+ return;
+
data.step = 0;
data.events = NULL;
@@ -788,6 +812,10 @@ test_cross_dir_moves (Fixture *fixture,
GError *error = NULL;
TestData data[2];
+ /* respect g_test_skip() during setup() */
+ if (g_test_failed ())
+ return;
+
data[0].step = 0;
data[0].events = NULL;
@@ -957,6 +985,10 @@ test_file_hard_links (Fixture *fixture,
GError *error = NULL;
TestData data;
+ /* respect g_test_skip() during setup() */
+ if (g_test_failed ())
+ return;
+
g_test_bug ("755721");
#ifdef HAVE_LINK

View File

@ -1,23 +0,0 @@
From: Debian GNOME Maintainers
<pkg-gnome-maintainers@lists.alioth.debian.org>
Date: Wed, 29 Jun 2022 08:02:49 +0000
Subject: fix-localization-issue
===================================================================
---
po/zh_CN.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 015feb1..b5a09aa 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -3344,7 +3344,7 @@ msgstr "源流已经关闭"
#: ../gio/gresolver.c:386 ../gio/gthreadedresolver.c:150
#: ../gio/gthreadedresolver.c:168
-#, fuzzy, c-format
+#, c-format
msgid "Error resolving “%s”: %s"
msgstr "解析“%s”时出错%s"

View File

@ -1,23 +0,0 @@
From: Debian GNOME Maintainers
<pkg-gnome-maintainers@lists.alioth.debian.org>
Date: Wed, 29 Jun 2022 08:02:49 +0000
Subject: fix-trash-issue-in-data
===================================================================
---
gio/glocalfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index bb7c863..3992574 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1989,7 +1989,7 @@ g_local_file_trash (GFile *file,
g_free (path);
}
- is_local_file_in_usershare = g_str_has_prefix(local->filename, "/data/usershare");
+ is_local_file_in_usershare = g_str_has_prefix(local->filename, "/data") && g_file_test ("/data/usershare", G_FILE_TEST_EXISTS);
if (file_stat.st_dev == home_stat.st_dev && !is_local_file_in_usershare)
{
is_homedir_trash = TRUE;

View File

@ -1,203 +0,0 @@
From: Philip Withnall <withnall@endlessm.com>
Date: Fri, 28 Feb 2020 15:15:02 +0000
Subject: [PATCH 1/2] tests: Use g_assert_*() in cancellable test rather than
g_assert()
`g_assert()` is compiled out if `G_DISABLE_ASSERT` is defined, and
`g_assert_*()` gives more detailed failure messages.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
---
gio/gcancellable.c | 43 ++++++++++++++++++++++++++
gio/tests/cancellable.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 122 insertions(+), 2 deletions(-)
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index d9e58b8..e687cca 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -643,6 +643,8 @@ typedef struct {
GCancellable *cancellable;
gulong cancelled_handler;
+ /* Protected by cancellable_mutex: */
+ gboolean resurrected_during_cancellation;
} GCancellableSource;
/*
@@ -661,8 +663,24 @@ cancellable_source_cancelled (GCancellable *cancellable,
gpointer user_data)
{
GSource *source = user_data;
+ GCancellableSource *cancellable_source = (GCancellableSource *) source;
+
+ g_mutex_lock (&cancellable_mutex);
+
+ /* Drop the reference added in cancellable_source_dispose(); see the comment there.
+ * The reference must be dropped after unlocking @cancellable_mutex since
+ * it could be the final reference, and the dispose function takes
+ * @cancellable_mutex. */
+ if (cancellable_source->resurrected_during_cancellation)
+ {
+ cancellable_source->resurrected_during_cancellation = FALSE;
+ g_mutex_unlock (&cancellable_mutex);
+ g_source_unref (source);
+ return;
+ }
g_source_ref (source);
+ g_mutex_unlock (&cancellable_mutex);
g_source_set_ready_time (source, 0);
g_source_unref (source);
}
@@ -684,12 +702,37 @@ cancellable_source_dispose (GSource *source)
{
GCancellableSource *cancellable_source = (GCancellableSource *)source;
+ g_mutex_lock (&cancellable_mutex);
+
if (cancellable_source->cancellable)
{
+ if (cancellable_source->cancellable->priv->cancelled_running)
+ {
+ /* There can be a race here: if thread A has called
+ * g_cancellable_cancel() and has got as far as committing to call
+ * cancellable_source_cancelled(), then thread B drops the final
+ * ref on the GCancellableSource before g_source_ref() is called in
+ * cancellable_source_cancelled(), then cancellable_source_dispose()
+ * will run through and the GCancellableSource will be finalised
+ * before cancellable_source_cancelled() gets to g_source_ref(). It
+ * will then be left in a state where its committed to using a
+ * dangling GCancellableSource pointer.
+ *
+ * Eliminate that race by resurrecting the #GSource temporarily, and
+ * then dropping that reference in cancellable_source_cancelled(),
+ * which should be guaranteed to fire because were inside a
+ * @cancelled_running block.
+ */
+ g_source_ref (source);
+ cancellable_source->resurrected_during_cancellation = TRUE;
+ }
+
g_clear_signal_handler (&cancellable_source->cancelled_handler,
cancellable_source->cancellable);
g_clear_object (&cancellable_source->cancellable);
}
+
+ g_mutex_unlock (&cancellable_mutex);
}
static gboolean
diff --git a/gio/tests/cancellable.c b/gio/tests/cancellable.c
index cd349a8..002bdcc 100644
--- a/gio/tests/cancellable.c
+++ b/gio/tests/cancellable.c
@@ -138,7 +138,7 @@ mock_operation_finish (GAsyncResult *result,
MockOperationData *data;
GTask *task;
- g_assert (g_task_is_valid (result, NULL));
+ g_assert_true (g_task_is_valid (result, NULL));
/* This test expects the return value to be iterations_done even
* when an error is set.
@@ -212,7 +212,7 @@ test_cancel_multiple_concurrent (void)
if (g_test_verbose ())
g_printerr ("CANCEL: %d operations\n", num_async_operations);
g_cancellable_cancel (cancellable);
- g_assert (g_cancellable_is_cancelled (cancellable));
+ g_assert_true (g_cancellable_is_cancelled (cancellable));
/* Wait for all operations to be cancelled */
g_main_loop_run (loop);
@@ -228,6 +228,82 @@ test_cancel_null (void)
g_cancellable_cancel (NULL);
}
+typedef struct
+{
+ GCond cond;
+ GMutex mutex;
+ GSource *cancellable_source; /* (owned) */
+} ThreadedDisposeData;
+
+static gboolean
+cancelled_cb (GCancellable *cancellable,
+ gpointer user_data)
+{
+ /* Nothing needs to be done here. */
+ return G_SOURCE_CONTINUE;
+}
+
+static gpointer
+threaded_dispose_thread_cb (gpointer user_data)
+{
+ ThreadedDisposeData *data = user_data;
+
+ /* Synchronise with the main thread before trying to reproduce the race. */
+ g_mutex_lock (&data->mutex);
+ g_cond_broadcast (&data->cond);
+ g_mutex_unlock (&data->mutex);
+
+ /* Race with cancellation of the cancellable. */
+ g_source_unref (data->cancellable_source);
+
+ return NULL;
+}
+
+static void
+test_cancellable_source_threaded_dispose (void)
+{
+ guint i;
+
+ g_test_summary ("Test a thread race between disposing of a GCancellableSource "
+ "(in one thread) and cancelling the GCancellable it refers "
+ "to (in another thread)");
+ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/issues/1841");
+
+ for (i = 0; i < 100000; i++)
+ {
+ GCancellable *cancellable = NULL;
+ GSource *cancellable_source = NULL;
+ ThreadedDisposeData data;
+ GThread *thread = NULL;
+
+ /* Create a cancellable and a cancellable source for it. For this test,
+ * theres no need to attach the source to a #GMainContext. */
+ cancellable = g_cancellable_new ();
+ cancellable_source = g_cancellable_source_new (cancellable);
+ g_source_set_callback (cancellable_source, G_SOURCE_FUNC (cancelled_cb), NULL, NULL);
+
+ /* Create a new thread and wait until its ready to execute before
+ * cancelling our cancellable. */
+ g_cond_init (&data.cond);
+ g_mutex_init (&data.mutex);
+ data.cancellable_source = g_steal_pointer (&cancellable_source);
+
+ g_mutex_lock (&data.mutex);
+ thread = g_thread_new ("/cancellable-source/threaded-dispose",
+ threaded_dispose_thread_cb, &data);
+ g_cond_wait (&data.cond, &data.mutex);
+ g_mutex_unlock (&data.mutex);
+
+ /* Race with disposal of the cancellable source. */
+ g_cancellable_cancel (cancellable);
+
+ g_thread_join (g_steal_pointer (&thread));
+ g_mutex_clear (&data.mutex);
+ g_cond_clear (&data.cond);
+ g_object_unref (cancellable);
+ }
+}
+
int
main (int argc, char *argv[])
{
@@ -235,6 +311,7 @@ main (int argc, char *argv[])
g_test_add_func ("/cancellable/multiple-concurrent", test_cancel_multiple_concurrent);
g_test_add_func ("/cancellable/null", test_cancel_null);
+ g_test_add_func ("/cancellable-source/threaded-dispose", test_cancellable_source_threaded_dispose);
return g_test_run ();
}

View File

@ -1,80 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Mon, 18 Dec 2017 18:06:05 +0000
Subject: gwakeuptest: Be less parallel unless invoked with -m slow
This is a workaround for test failures on the reproducible-builds
infrastructure, where a multi-threaded stress-test sometimes takes longer
to finish on x86_64 than it would have done on slow architectures like
arm and mips on the official Debian autobuilders. It is not clear why.
This change will make this test more likely to pass, but less likely to
detect bugs.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/884659
Forwarded: no
---
glib/tests/gwakeuptest.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/glib/tests/gwakeuptest.c b/glib/tests/gwakeuptest.c
index 461a7d3..2c3eccd 100644
--- a/glib/tests/gwakeuptest.c
+++ b/glib/tests/gwakeuptest.c
@@ -89,6 +89,9 @@ struct context
#define NUM_TOKENS 5
#define TOKEN_TTL 100000
+static gint num_threads = NUM_THREADS;
+static gint token_ttl = TOKEN_TTL;
+
static struct context contexts[NUM_THREADS];
static GThread *threads[NUM_THREADS];
static GWakeup *last_token_wakeup;
@@ -158,7 +161,7 @@ dispatch_token (struct token *token)
struct context *ctx;
gint next_ctx;
- next_ctx = g_test_rand_int_range (0, NUM_THREADS);
+ next_ctx = g_test_rand_int_range (0, num_threads);
ctx = &contexts[next_ctx];
token->owner = ctx;
token->ttl--;
@@ -213,6 +216,12 @@ test_threaded (void)
{
gint i;
+ if (!g_test_slow ())
+ {
+ num_threads = NUM_THREADS / 10;
+ token_ttl = TOKEN_TTL / 10;
+ }
+
/* make sure we don't block forever */
alarm (60);
@@ -230,7 +239,7 @@ test_threaded (void)
last_token_wakeup = g_wakeup_new ();
/* create contexts, assign to threads */
- for (i = 0; i < NUM_THREADS; i++)
+ for (i = 0; i < num_threads; i++)
{
context_init (&contexts[i]);
threads[i] = g_thread_new ("test", thread_func, &contexts[i]);
@@ -238,13 +247,13 @@ test_threaded (void)
/* dispatch tokens */
for (i = 0; i < NUM_TOKENS; i++)
- dispatch_token (token_new (TOKEN_TTL));
+ dispatch_token (token_new (token_ttl));
/* wait until all tokens are gone */
wait_for_signaled (last_token_wakeup);
/* ask threads to quit, join them, cleanup */
- for (i = 0; i < NUM_THREADS; i++)
+ for (i = 0; i < num_threads; i++)
{
context_quit (&contexts[i]);
g_thread_join (threads[i]);

File diff suppressed because it is too large Load Diff