apply old patches on new upstream versions

This commit is contained in:
Yue-Lan 2024-05-23 16:45:10 +08:00
parent eebfc4ceb8
commit de9bcffe2a
34 changed files with 844142 additions and 154 deletions

843197
debian/patches/-1.patch vendored Normal file

File diff suppressed because it is too large Load Diff

27
debian/patches/.patch vendored Normal file
View File

@ -0,0 +1,27 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Thu, 29 Feb 2024 16:14:23 +0800
Subject: =?utf-8?b?5L+u5aSN57yW6K+R6Zeu6aKY?=
---
gio/gportalsupport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c
index d82d763..6654cb0 100644
--- a/gio/gportalsupport.c
+++ b/gio/gportalsupport.c
@@ -194,12 +194,12 @@ glib_has_dconf_access_in_sandbox (void)
gboolean
glib_is_force_use_portal (void)
{
- read_flatpak_info ();
+ sandbox_info_read ();
return force_use_portal;
}
gboolean glib_should_use_kylin_process_manager (void)
{
- read_flatpak_info ();
+ sandbox_info_read ();
return use_kylin_process_manager;
}

68
debian/patches/166960.patch vendored Normal file
View File

@ -0,0 +1,68 @@
From: Yue-Lan <lanyue@ubuntukylin.com>
Date: Mon, 12 Jun 2023 17:07:42 +0800
Subject: =?utf-8?b?IzE2Njk2MCDjgJDmlofku7bnrqHnkIblmajjgJHlnKjmnYPpmZDnu4Y=?=
=?utf-8?b?5YyW55WM6Z2i5re75Yqg5a6M5YW25LuW55So5oi35p2D6ZmQ5ZCO77yM5a+56K+l?=
=?utf-8?b?5paH5qGj6L+b6KGM57yW6L6R5L+d5a2Y5ZCO77yM57uG5YyW5p2D6ZmQ55WM6Z2i?=
=?utf-8?b?6ZyA6KaB6YeN5paw5re75Yqg5YW25LuW55So5oi35p2D6ZmQ?=
---
gio/glocalfileoutputstream.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
index 6875811..da63d6e 100644
--- a/gio/glocalfileoutputstream.c
+++ b/gio/glocalfileoutputstream.c
@@ -46,6 +46,7 @@
#include <unistd.h>
#include "gfiledescriptorbased.h"
#include <sys/uio.h>
+#include <sys/xattr.h>
#endif
#include "glib-private.h"
@@ -860,6 +861,21 @@ handle_overwrite_open (const char *filename,
int errsv = 0;
gboolean replace_destination_set = (flags & G_FILE_CREATE_REPLACE_DESTINATION);
+ #ifdef G_OS_UNIX
+ char acl_buf[1024];
+ ssize_t acl_size = getxattr(filename, "system.posix_acl_access", acl_buf, sizeof(acl_buf));
+
+ gboolean has_acl_buf = FALSE;
+ if (acl_size == -1) {
+ g_debug("Error getting ACL with %s", filename);
+ } else if (acl_size == 0) {
+ g_debug("No ACL found with %s.\n", filename);
+ } else {
+ g_debug("%s ACL: %.*s\n", filename, (int)acl_size, acl_buf);
+ has_acl_buf = TRUE;
+ }
+#endif
+
mode = mode_from_flags_or_info (flags, reference_info);
/* We only need read access to the original file if we are creating a backup.
@@ -1038,6 +1054,7 @@ handle_overwrite_open (const char *filename,
dirname = g_path_get_dirname (filename);
tmp_filename = g_build_filename (dirname, ".goutputstream-XXXXXX", NULL);
+
g_free (dirname);
tmpfd = g_mkstemp_full (tmp_filename, (readable ? O_RDWR : O_WRONLY) | O_BINARY | O_CLOEXEC, mode);
@@ -1045,7 +1062,13 @@ handle_overwrite_open (const char *filename,
{
g_free (tmp_filename);
goto fallback_strategy;
- }
+ } else {
+#ifdef G_OS_UNIX
+ if (has_acl_buf) {
+ setxattr(tmp_filename, "system.posix_acl_access", acl_buf, acl_size, 0);
+ }
+#endif
+ }
/* try to keep permissions (unless replacing) */

27
debian/patches/169359-U.patch vendored Normal file
View File

@ -0,0 +1,27 @@
From: Yue-Lan <lanyue@ubuntukylin.com>
Date: Mon, 8 May 2023 10:48:52 +0800
Subject: =?utf-8?b?IzE2OTM1OSDjgJDluILlnLrjgJHjgJDkurrooYzmuIXnrpfkuK3lv4M=?=
=?utf-8?b?44CR5oyC6L29VeebmOWQjuaWh+S7tueuoeeQhuWZqOaYvuekuuaWh+S7tuW8gg==?=
=?utf-8?b?5bi4?=
---
gio/glocalfileenumerator.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gio/glocalfileenumerator.c b/gio/glocalfileenumerator.c
index 3694896..2057a49 100644
--- a/gio/glocalfileenumerator.c
+++ b/gio/glocalfileenumerator.c
@@ -435,7 +435,11 @@ g_local_file_enumerator_next_file (GFileEnumerator *enumerator,
{
g_error_free (my_error);
goto next_file;
- }
+ } else if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE))
+ {
+ g_error_free (my_error);
+ goto next_file;
+ }
else
g_propagate_error (error, my_error);
}

View File

@ -0,0 +1,23 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Wed, 6 Dec 2023 09:39:18 +0800
Subject: =?utf-8?b?5L+u5pS5IDVjNTIxMTdjNGFlOTM2N2M5NjYwOTkxNWZkZTVhMjgwMTAx?=
=?utf-8?b?YTliMGIg5YWz5LqOR0xJQl9GT1JDRV9VU0VfUE9SVEFM55qE5Yid5aeL5YyW6YC7?=
=?utf-8?b?6L6R77yM5LiN5YaN5L6d6LWWR1RLX1VTRV9QT1JUQUw=?=
---
gio/gportalsupport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c
index 6654cb0..65121ee 100644
--- a/gio/gportalsupport.c
+++ b/gio/gportalsupport.c
@@ -142,7 +142,7 @@ sandbox_info_read (void)
network_available = TRUE;
dconf_access = TRUE;
env_var = g_getenv ("GLIB_FORCE_USE_PORTAL");
- if (env_var && env_var[0] == '1' && use_portal)
+ if (env_var && env_var[0] == '1')
force_use_portal = TRUE;
}
break;

View File

@ -1,4 +1,3 @@
From a0de90583f3a275ff17bc8b611ea8f9637f2bbd5 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 8 Mar 2024 14:19:46 +0000
Subject: [PATCH 01/16] tests: Add a data-driven test for signal subscriptions
@ -14,11 +13,14 @@ same message to multiple destinations is handled appropriately).
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/tests/gdbus-subscribe.c | 938 ++++++++++++++++++++++++++++++++++++
gio/tests/gdbus-subscribe.c | 938 ++++++++++++++++++++++++++++++++++++++++++++
gio/tests/meson.build | 4 +
2 files changed, 942 insertions(+)
create mode 100644 gio/tests/gdbus-subscribe.c
diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c
new file mode 100644
index 0000000..3f53e1d
--- /dev/null
+++ b/gio/tests/gdbus-subscribe.c
@@ -0,0 +1,938 @@
@ -960,6 +962,8 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
+
+ return g_test_run();
+}
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index 232ecca..f1a3d2b 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
@@ -491,6 +491,10 @@ if host_machine.system() != 'windows'

View File

@ -1,4 +1,3 @@
From 70a82ef96e12e8870677ab835ce2df554b4f4790 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 8 Mar 2024 19:28:15 +0000
Subject: [PATCH 02/16] tests: Add support for subscribing to signals from a
@ -6,11 +5,11 @@ Subject: [PATCH 02/16] tests: Add support for subscribing to signals from a
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/tests/gdbus-subscribe.c | 133 ++++++++++++++++++++++++++++++++++--
gio/tests/gdbus-subscribe.c | 133 +++++++++++++++++++++++++++++++++++++++++---
1 file changed, 126 insertions(+), 7 deletions(-)
diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c
index 3f53e1d7f8..3d2a14e03b 100644
index 3f53e1d..3d2a14e 100644
--- a/gio/tests/gdbus-subscribe.c
+++ b/gio/tests/gdbus-subscribe.c
@@ -7,6 +7,9 @@
@ -244,7 +243,3 @@ index 3f53e1d7f8..3d2a14e03b 100644
return g_test_run();
}
--
GitLab

View File

@ -1,4 +1,3 @@
From b4b7411e673e0148b024494e6ae7c873dd8e2ae5 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 8 Mar 2024 19:44:03 +0000
Subject: [PATCH 03/16] tests: Add a test-case for what happens if a unique
@ -10,11 +9,11 @@ GDBusProxy in this situation, but it seems that was a false alarm.
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/tests/gdbus-subscribe.c | 48 +++++++++++++++++++++++++++++++++++++
gio/tests/gdbus-subscribe.c | 48 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c
index 3d2a14e03b..350ec9f52f 100644
index 3d2a14e..350ec9f 100644
--- a/gio/tests/gdbus-subscribe.c
+++ b/gio/tests/gdbus-subscribe.c
@@ -358,6 +358,53 @@ static const TestPlan plan_limit_by_unique_name =
@ -79,7 +78,3 @@ index 3d2a14e03b..350ec9f52f 100644
ADD_SUBSCRIBE_TEST (limit_by_well_known_name);
return g_test_run();
--
GitLab

View File

@ -1,4 +1,3 @@
From e6cd64c66c5bd2de4ae0ca632263ae9a9b136fc3 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 8 Mar 2024 20:10:29 +0000
Subject: [PATCH 04/16] tests: Add test coverage for signals that match the
@ -9,11 +8,11 @@ a well-known name.
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/tests/gdbus-subscribe.c | 161 ++++++++++++++++++++++++++++++++++--
gio/tests/gdbus-subscribe.c | 161 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 154 insertions(+), 7 deletions(-)
diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c
index 350ec9f52f..af100de7dc 100644
index 350ec9f..af100de 100644
--- a/gio/tests/gdbus-subscribe.c
+++ b/gio/tests/gdbus-subscribe.c
@@ -13,6 +13,7 @@
@ -254,7 +253,3 @@ index 350ec9f52f..af100de7dc 100644
return g_test_run();
}
--
GitLab

View File

@ -1,4 +1,3 @@
From bd1bb4f5e094cf3fd329a10471d6616fde0ca92f Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 14 Mar 2024 19:18:15 +0000
Subject: [PATCH 05/16] gdbusprivate: Add symbolic constants for the message
@ -21,7 +20,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
1 file changed, 5 insertions(+)
diff --git a/gio/gdbusprivate.h b/gio/gdbusprivate.h
index e7a5bfa4f1..57147e1729 100644
index e7a5bfa..57147e1 100644
--- a/gio/gdbusprivate.h
+++ b/gio/gdbusprivate.h
@@ -27,6 +27,11 @@
@ -36,7 +35,3 @@ index e7a5bfa4f1..57147e1729 100644
/* ---------------------------------------------------------------------------------------------------- */
typedef struct GDBusWorker GDBusWorker;
--
GitLab

View File

@ -1,8 +1,7 @@
From c5126b330870dbeaa2146e81db9b0ce8dc96c712 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 14 Mar 2024 19:24:24 +0000
Subject: [PATCH 06/16] gdbusconnection: Move SignalData, SignalSubscriber
higher up
Subject: [PATCH 06/16] gdbusconnection: Move SignalData,
SignalSubscriber higher up
Subsequent changes will need to access these data structures from
on_worker_message_received(). No functional change here, only moving
@ -10,12 +9,14 @@ code around.
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/gdbusconnection.c | 128 +++++++++++++++++++++---------------------
gio/gdbusconnection.c | 128 +++++++++++++++++++++++++-------------------------
1 file changed, 65 insertions(+), 63 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 42134a6..73dd8ff 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -287,6 +287,71 @@ call_destroy_notify (GMainContext *cont
@@ -287,6 +287,71 @@ call_destroy_notify (GMainContext *context,
/* ---------------------------------------------------------------------------------------------------- */
@ -87,7 +88,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
#ifdef G_OS_WIN32
#define CONNECTION_ENSURE_LOCK(obj) do { ; } while (FALSE)
#else
@@ -3247,69 +3312,6 @@ g_dbus_connection_remove_filter (GDBusCo
@@ -3247,69 +3312,6 @@ g_dbus_connection_remove_filter (GDBusConnection *connection,
/* ---------------------------------------------------------------------------------------------------- */

View File

@ -1,4 +1,3 @@
From 91fe59eeefeae6c211528f7f804bc37ae8d29c1d Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 14 Mar 2024 19:30:12 +0000
Subject: [PATCH 07/16] gdbusconnection: Factor out signal_data_new_take()
@ -12,6 +11,8 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
gio/gdbusconnection.c | 42 ++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 73dd8ff..ac55574 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -336,6 +336,30 @@ typedef struct
@ -45,7 +46,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
static void
signal_data_free (SignalData *signal_data)
{
@@ -3578,16 +3602,14 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3578,16 +3602,14 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
goto out;
}

View File

@ -1,4 +1,3 @@
From a8187079dae930fc52409e6ad4e4a7cdf11171e7 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 23 Apr 2024 20:31:57 +0100
Subject: [PATCH 08/16] gdbusconnection: Factor out add_signal_data()
@ -7,12 +6,14 @@ No functional changes.
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/gdbusconnection.c | 64 +++++++++++++++++++++++++------------------
gio/gdbusconnection.c | 64 +++++++++++++++++++++++++++++----------------------
1 file changed, 37 insertions(+), 27 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index ac55574..de29cd3 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -3456,6 +3456,42 @@ is_signal_data_for_name_lost_or_acquired
@@ -3456,6 +3456,42 @@ is_signal_data_for_name_lost_or_acquired (SignalData *signal_data)
/* ---------------------------------------------------------------------------------------------------- */
@ -55,7 +56,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
/**
* g_dbus_connection_signal_subscribe:
* @connection: a #GDBusConnection
@@ -3545,7 +3581,6 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3545,7 +3581,6 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
gchar *rule;
SignalData *signal_data;
SignalSubscriber *subscriber;
@ -63,7 +64,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
const gchar *sender_unique_name;
/* Right now we abort if AddMatch() fails since it can only fail with the bus being in
@@ -3611,32 +3646,7 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3611,32 +3646,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
g_strdup (arg0),
flags);
g_ptr_array_add (signal_data->subscribers, subscriber);

View File

@ -1,4 +1,3 @@
From d31f0777d12d22e1d27ba2bb544a9040ce51940f Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 14 Mar 2024 19:51:59 +0000
Subject: [PATCH 09/16] gdbusconnection: Factor out
@ -13,12 +12,14 @@ a SignalData to be still in use and therefore not eligible to be removed.
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/gdbusconnection.c | 83 +++++++++++++++++++++++++------------------
gio/gdbusconnection.c | 83 +++++++++++++++++++++++++++++----------------------
1 file changed, 48 insertions(+), 35 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index de29cd3..278e9ca 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -3660,6 +3660,52 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3660,6 +3660,52 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
/* ---------------------------------------------------------------------------------------------------- */
@ -71,7 +72,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
/* called in any thread */
/* must hold lock when calling this (except if connection->finalizing is TRUE)
* returns the number of removed subscribers */
@@ -3668,7 +3714,6 @@ unsubscribe_id_internal (GDBusConnection
@@ -3668,7 +3714,6 @@ unsubscribe_id_internal (GDBusConnection *connection,
guint subscription_id)
{
SignalData *signal_data;
@ -79,7 +80,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
guint n;
guint n_removed = 0;
@@ -3695,40 +3740,8 @@ unsubscribe_id_internal (GDBusConnection
@@ -3695,40 +3740,8 @@ unsubscribe_id_internal (GDBusConnection *connection,
GUINT_TO_POINTER (subscription_id)));
n_removed++;
g_ptr_array_remove_index_fast (signal_data->subscribers, n);

View File

@ -1,4 +1,3 @@
From 0bca1891a734de82bd7e0f2c09507ca285c3d1f4 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 23 Apr 2024 20:39:05 +0100
Subject: [PATCH 10/16] gdbusconnection: Stop storing sender_unique_name in
@ -19,6 +18,8 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
gio/gdbusconnection.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 278e9ca..761b5e5 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -327,19 +327,19 @@ typedef struct
@ -52,7 +53,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
signal_data->interface_name = interface_name;
signal_data->member = member;
signal_data->object_path = object_path;
@@ -365,7 +365,6 @@ signal_data_free (SignalData *signal_dat
@@ -365,7 +365,6 @@ signal_data_free (SignalData *signal_data)
{
g_free (signal_data->rule);
g_free (signal_data->sender);
@ -60,7 +61,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
g_free (signal_data->interface_name);
g_free (signal_data->member);
g_free (signal_data->object_path);
@@ -3447,7 +3446,7 @@ remove_match_rule (GDBusConnection *conn
@@ -3447,7 +3446,7 @@ remove_match_rule (GDBusConnection *connection,
static gboolean
is_signal_data_for_name_lost_or_acquired (SignalData *signal_data)
{
@ -69,7 +70,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
g_strcmp0 (signal_data->interface_name, "org.freedesktop.DBus") == 0 &&
g_strcmp0 (signal_data->object_path, "/org/freedesktop/DBus") == 0 &&
(g_strcmp0 (signal_data->member, "NameLost") == 0 ||
@@ -3459,7 +3458,8 @@ is_signal_data_for_name_lost_or_acquired
@@ -3459,7 +3458,8 @@ is_signal_data_for_name_lost_or_acquired (SignalData *signal_data)
/* called in any thread, connection lock is held */
static void
add_signal_data (GDBusConnection *connection,
@ -79,7 +80,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
{
GPtrArray *signal_data_array;
@@ -3479,12 +3479,12 @@ add_signal_data (GDBusConnection *connec
@@ -3479,12 +3479,12 @@ add_signal_data (GDBusConnection *connection,
}
signal_data_array = g_hash_table_lookup (connection->map_sender_unique_name_to_signal_data_array,
@ -94,7 +95,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
signal_data_array);
}
g_ptr_array_add (signal_data_array, signal_data);
@@ -3581,6 +3581,7 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3581,6 +3581,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
gchar *rule;
SignalData *signal_data;
SignalSubscriber *subscriber;
@ -102,7 +103,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
const gchar *sender_unique_name;
/* Right now we abort if AddMatch() fails since it can only fail with the bus being in
@@ -3616,6 +3617,11 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3616,6 +3617,11 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
rule = args_to_rule (sender, interface_name, member, object_path, arg0, flags);
if (sender != NULL && (g_dbus_is_unique_name (sender) || g_strcmp0 (sender, "org.freedesktop.DBus") == 0))
@ -114,7 +115,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
sender_unique_name = sender;
else
sender_unique_name = "";
@@ -3639,14 +3645,14 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3639,14 +3645,14 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
signal_data = signal_data_new_take (g_steal_pointer (&rule),
g_strdup (sender),

View File

@ -1,4 +1,3 @@
From d6c2a2f12e262a4150456a3dac25e9e5628830f2 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 23 Apr 2024 20:42:17 +0100
Subject: [PATCH 11/16] gdbus: Track name owners for signal subscriptions
@ -14,15 +13,18 @@ which messages are received is the order in which they are processed.
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/gdbusconnection.c | 350 +++++++++++++++++++++++++++++++++++++++++-
gio/gdbusconnection.c | 350 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 343 insertions(+), 7 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 761b5e5..a0ebe37 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -325,6 +325,31 @@ signal_subscriber_unref (SignalSubscribe
@@ -324,6 +324,31 @@ signal_subscriber_unref (SignalSubscriber *subscriber)
}
typedef struct
{
+{
+ /*
+ * 1 reference while waiting for GetNameOwner() to finish
+ * 1 reference for each SignalData that points to this one as its
@ -47,10 +49,9 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
+typedef struct SignalData SignalData;
+
+struct SignalData
+{
{
gchar *rule;
gchar *sender;
gchar *interface_name;
@@ -333,13 +358,36 @@ typedef struct
gchar *arg0;
GDBusSignalFlags flags;
@ -117,7 +118,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
g_free (signal_data->rule);
g_free (signal_data->sender);
g_free (signal_data->interface_name);
@@ -370,6 +428,7 @@ signal_data_free (SignalData *signal_dat
@@ -370,6 +428,7 @@ signal_data_free (SignalData *signal_data)
g_free (signal_data->object_path);
g_free (signal_data->arg0);
g_ptr_array_unref (signal_data->subscribers);
@ -133,7 +134,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
/* Maps used for managing signal subscription, protected by @lock */
GHashTable *map_rule_to_signal_data; /* match rule (gchar*) -> SignalData */
@@ -741,6 +801,7 @@ g_dbus_connection_finalize (GObject *obj
@@ -741,6 +801,7 @@ g_dbus_connection_finalize (GObject *object)
g_error_free (connection->initialization_error);
g_hash_table_unref (connection->map_method_serial_to_task);
@ -141,7 +142,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
g_hash_table_unref (connection->map_rule_to_signal_data);
g_hash_table_unref (connection->map_id_to_signal_data);
@@ -1127,6 +1188,7 @@ g_dbus_connection_init (GDBusConnection
@@ -1127,6 +1188,7 @@ g_dbus_connection_init (GDBusConnection *connection)
g_mutex_init (&connection->init_lock);
connection->map_method_serial_to_task = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
@ -149,7 +150,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
connection->map_rule_to_signal_data = g_hash_table_new (g_str_hash,
g_str_equal);
@@ -2254,6 +2316,191 @@ g_dbus_connection_send_message_with_repl
@@ -2254,6 +2316,191 @@ g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connecti
/* ---------------------------------------------------------------------------------------------------- */
@ -341,7 +342,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
typedef struct
{
guint id;
@@ -2377,6 +2624,7 @@ on_worker_message_received (GDBusWorker
@@ -2377,6 +2624,7 @@ on_worker_message_received (GDBusWorker *worker,
{
guint32 reply_serial;
GTask *task;
@ -349,7 +350,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
reply_serial = g_dbus_message_get_reply_serial (message);
CONNECTION_LOCK (connection);
@@ -2392,6 +2640,19 @@ on_worker_message_received (GDBusWorker
@@ -2392,6 +2640,19 @@ on_worker_message_received (GDBusWorker *worker,
{
//g_debug ("message reply/error for serial %d but no SendMessageData found for %p", reply_serial, connection);
}
@ -369,7 +370,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
CONNECTION_UNLOCK (connection);
}
else if (message_type == G_DBUS_MESSAGE_TYPE_SIGNAL)
@@ -3580,6 +3841,7 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3580,6 +3841,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
{
gchar *rule;
SignalData *signal_data;
@ -377,7 +378,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
SignalSubscriber *subscriber;
gboolean sender_is_its_own_owner;
const gchar *sender_unique_name;
@@ -3645,13 +3907,59 @@ g_dbus_connection_signal_subscribe (GDBu
@@ -3645,13 +3907,59 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
signal_data = signal_data_new_take (g_steal_pointer (&rule),
g_strdup (sender),
@ -438,7 +439,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
add_signal_data (connection, signal_data, sender_unique_name);
out:
@@ -3679,10 +3987,18 @@ remove_signal_data_if_unused (GDBusConne
@@ -3679,10 +3987,18 @@ remove_signal_data_if_unused (GDBusConnection *connection,
const gchar *sender_unique_name;
GPtrArray *signal_data_array;
@ -458,7 +459,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
sender_unique_name = signal_data->sender;
else
sender_unique_name = "";
@@ -3715,6 +4031,15 @@ remove_signal_data_if_unused (GDBusConne
@@ -3715,6 +4031,15 @@ remove_signal_data_if_unused (GDBusConnection *connection,
remove_match_rule (connection, signal_data->rule);
}
@ -474,7 +475,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
signal_data_free (signal_data);
}
@@ -3991,6 +4316,17 @@ schedule_callbacks (GDBusConnection *con
@@ -3991,6 +4316,17 @@ schedule_callbacks (GDBusConnection *connection,
continue;
}
@ -492,7 +493,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
for (m = 0; m < signal_data->subscribers->len; m++)
{
SignalSubscriber *subscriber = signal_data->subscribers->pdata[m];
@@ -4062,7 +4398,7 @@ distribute_signals (GDBusConnection *con
@@ -4062,7 +4398,7 @@ distribute_signals (GDBusConnection *connection,
schedule_callbacks (connection, signal_data_array, message, sender);
}

View File

@ -1,4 +1,3 @@
From ad8e763f73d196149c64c3f39a1268200dc56b97 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Thu, 14 Mar 2024 20:42:41 +0000
Subject: [PATCH 12/16] gdbusconnection: Don't deliver signals if the sender
@ -15,9 +14,11 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
gio/gdbusconnection.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index a0ebe37..e707716 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -4299,6 +4299,46 @@ schedule_callbacks (GDBusConnection *con
@@ -4299,6 +4299,46 @@ schedule_callbacks (GDBusConnection *connection,
if (signal_data->object_path != NULL && g_strcmp0 (signal_data->object_path, path) != 0)
continue;

View File

@ -1,4 +1,3 @@
From 1c9f335e90335c68787ed662e17a4fd4cf32de72 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 8 Mar 2024 19:51:50 +0000
Subject: [PATCH 13/16] tests: Add a test for matching by two well-known names
@ -15,7 +14,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
1 file changed, 13 insertions(+)
diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c
index af100de7dc..171d6107d9 100644
index af100de..171d610 100644
--- a/gio/tests/gdbus-subscribe.c
+++ b/gio/tests/gdbus-subscribe.c
@@ -440,6 +440,19 @@ static const TestPlan plan_limit_by_well_known_name =
@ -38,7 +37,3 @@ index af100de7dc..171d6107d9 100644
{
/* Service claims another name */
.action = TEST_ACTION_OWN_NAME,
--
GitLab

View File

@ -1,4 +1,3 @@
From 7bf6cc5a8f6fade9c90c5b30b2a25d27936371b1 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 8 Mar 2024 19:53:22 +0000
Subject: [PATCH 14/16] tests: Add a test for signal filtering by well-known
@ -16,7 +15,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
1 file changed, 27 insertions(+)
diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c
index 171d6107d9..5406ba7e21 100644
index 171d610..5406ba7 100644
--- a/gio/tests/gdbus-subscribe.c
+++ b/gio/tests/gdbus-subscribe.c
@@ -440,6 +440,33 @@ static const TestPlan plan_limit_by_well_known_name =
@ -53,7 +52,3 @@ index 171d6107d9..5406ba7e21 100644
{
/* When the service sends a signal with the name it already owns,
* it should get through */
--
GitLab

View File

@ -1,4 +1,3 @@
From 2b9ede6293d5b9672e21bccd7afccabc0b59c2d4 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 23 Apr 2024 21:39:43 +0100
Subject: [PATCH 15/16] tests: Ensure that unsubscribing with GetNameOwner
@ -17,11 +16,11 @@ name_watcher_unref_watched_name() that get_name_owner_serial == 0
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
gio/tests/gdbus-subscribe.c | 52 ++++++++++++++++++++++++++++++++++++-
gio/tests/gdbus-subscribe.c | 52 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c
index 5406ba7e21..4cba4f5656 100644
index 5406ba7..4cba4f5 100644
--- a/gio/tests/gdbus-subscribe.c
+++ b/gio/tests/gdbus-subscribe.c
@@ -116,6 +116,7 @@ typedef struct
@ -112,7 +111,3 @@ index 5406ba7e21..4cba4f5656 100644
return g_test_run();
}
--
GitLab

View File

@ -1,4 +1,3 @@
From ded4e7e0256dd1a99e7acc025ede0e7f57436c8b Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Mon, 6 May 2024 21:24:53 +0100
Subject: [PATCH 16/16] gdbus-proxy test: Wait before asserting name owner has
@ -25,7 +24,7 @@ Signed-off-by: Simon McVittie <smcv@debian.org>
1 file changed, 6 insertions(+)
diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c
index ac5f720fad..ab36eae0e1 100644
index ac5f720..ab36eae 100644
--- a/gio/tests/gdbus-proxy.c
+++ b/gio/tests/gdbus-proxy.c
@@ -780,6 +780,12 @@ kill_test_service (GDBusConnection *connection)
@ -41,6 +40,3 @@ index ac5f720fad..ab36eae0e1 100644
g_bus_unwatch_name (watch_id);
#else
g_warning ("Can't kill com.example.TestService");
--
GitLab

View File

@ -1,4 +1,3 @@
From 7d65f6c5a20f67aa9a857d0f7b0bf5de4d75be9b Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 8 May 2024 14:46:08 +0000
Subject: [PATCH] gdbusconnection: Allow name owners to have the syntax of a
@ -26,9 +25,11 @@ Signed-off-by: Simon McVittie <smcv@debian.org>
gio/gdbusconnection.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index e707716..84d45ef 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -2379,7 +2379,10 @@ name_watcher_deliver_name_owner_changed_
@@ -2379,7 +2379,10 @@ name_watcher_deliver_name_owner_changed_unlocked (SignalData *name_watcher,
/* Our caller already checked this */
g_assert (g_strcmp0 (name_watcher->arg0, name) == 0);
@ -40,7 +41,7 @@ Signed-off-by: Simon McVittie <smcv@debian.org>
name_watcher_set_name_owner_unlocked (name_watcher, new_owner);
else
g_warning ("Received NameOwnerChanged signal with invalid owner \"%s\" for \"%s\"",
@@ -2431,7 +2434,10 @@ name_watcher_deliver_get_name_owner_repl
@@ -2431,7 +2434,10 @@ name_watcher_deliver_get_name_owner_reply_unlocked (SignalData *name_watcher,
g_variant_get (body, "(&s)", &new_owner);

59
debian/patches/FIX-182831-U.patch vendored Normal file
View File

@ -0,0 +1,59 @@
From: Yue-Lan <lanyue@ubuntukylin.com>
Date: Wed, 19 Jul 2023 11:32:14 +0800
Subject: =?utf-8?b?W0ZJWF0gIzE4MjgzMSDjgJDmlofku7bnrqHnkIblmajjgJHliKDpmaQ=?=
=?utf-8?b?5LuOVeebmOaLt+i0neWIsOacrOWcsOmVv+aWh+S7tuWQjeensOeahOaWh+S7tg==?=
=?utf-8?b?6Iez5Zue5pS256uZ77yM5Zue5pS256uZ5Lit6K+l5paH5Lu25LiN5pi+56S65Y6f?=
=?utf-8?b?5aeL6Lev5b6E?=
---
gio/glocalfile.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index ceb888a..112517c 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1997,6 +1997,8 @@ g_local_file_trash (GFile *file,
GVfsClass *class;
GVfs *vfs;
int errsv;
+ GError *set_contents_error;
+ FILE *info_file;
if (glib_should_use_portal ())
return g_trash_portal_trash_file (file, error);
@@ -2285,18 +2287,24 @@ g_local_file_trash (GFile *file,
original_name_escaped, delete_time);
g_free (delete_time);
- if (!g_file_set_contents_full (infofile, data, -1,
+ set_contents_error = NULL;
+ g_file_set_contents_full (infofile, data, -1,
G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING,
- 0600, error))
- {
- g_unlink (infofile);
-
- g_free (filesdir);
- g_free (trashname);
- g_free (infofile);
-
- return FALSE;
+ 0600, &set_contents_error);
+ if (set_contents_error) {
+#ifdef G_OS_UNIX
+ if (g_error_matches (set_contents_error, G_FILE_ERROR, G_FILE_ERROR_NAMETOOLONG)) {
+ // direct write file
+ info_file = fopen (infofile, "w");
+ if (info_file) {
+ fwrite (data, 1, strlen(data), info_file);
+ fflush (info_file);
+ fclose (info_file);
+ }
}
+#endif
+ g_error_free (set_contents_error);
+ }
/* TODO: Maybe we should verify that you can delete the file from the trash
* before moving it? OTOH, that is hard, as it needs a recursive scan

View File

@ -0,0 +1,153 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Fri, 1 Dec 2023 11:39:02 +0800
Subject: =?utf-8?b?5re75YqgR0xJQl9GT1JDRV9VU0VfUE9SVEFM546v5aKD5Y+Y6YeP77yM?=
=?utf-8?b?5b2TR1RLX1VTRV9QT1JUQUw9MeS4lEdMSUJfRk9SQ0VfVVNFX1BPUlRBTD0x5pe2?=
=?utf-8?b?77yMZ19hcHBfaW5mb19sYXVuY2hfZGVmYXVsdF9mb3JfdXJpKCnlkoxnX2FwcF9p?=
=?utf-8?b?bmZvX2xhdW5jaF9kZWZhdWx0X2Zvcl91cmlfYXN5bmMoKeS8muW8uuWItui1sHhk?=
=?utf-8?b?Zy1kZXNrdG9wLXBvcnRhbOaJk+W8gOaWh+S7tg==?=
---
gio/gappinfo.c | 57 ++++++++++++++++++++++++++++------------------------
gio/gportalsupport.c | 15 ++++++++++++++
gio/gportalsupport.h | 1 +
3 files changed, 47 insertions(+), 26 deletions(-)
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index 652cae6..d30f383 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -991,33 +991,38 @@ g_app_info_launch_default_for_uri (const char *uri,
char *uri_scheme;
GAppInfo *app_info = NULL;
gboolean res = FALSE;
+ gboolean force_use_portal = FALSE;
+ force_use_portal = glib_is_force_use_portal ();
- /* g_file_query_default_handler() calls
- * g_app_info_get_default_for_uri_scheme() too, but we have to do it
- * here anyway in case GFile can't parse @uri correctly.
- */
- uri_scheme = g_uri_parse_scheme (uri);
- if (uri_scheme && uri_scheme[0] != '\0')
- app_info = g_app_info_get_default_for_uri_scheme (uri_scheme);
- g_free (uri_scheme);
-
- if (!app_info)
- {
- GFile *file;
-
- file = g_file_new_for_uri (uri);
- app_info = g_file_query_default_handler (file, NULL, error);
- g_object_unref (file);
- }
-
- if (app_info)
+ if (!force_use_portal)
{
- GList l;
-
- l.data = (char *)uri;
- l.next = l.prev = NULL;
- res = g_app_info_launch_uris (app_info, &l, launch_context, error);
- g_object_unref (app_info);
+ /* g_file_query_default_handler() calls
+ * g_app_info_get_default_for_uri_scheme() too, but we have to do it
+ * here anyway in case GFile can't parse @uri correctly.
+ */
+ uri_scheme = g_uri_parse_scheme (uri);
+ if (uri_scheme && uri_scheme[0] != '\0')
+ app_info = g_app_info_get_default_for_uri_scheme (uri_scheme);
+ g_free (uri_scheme);
+
+ if (!app_info)
+ {
+ GFile *file;
+
+ file = g_file_new_for_uri (uri);
+ app_info = g_file_query_default_handler (file, NULL, error);
+ g_object_unref (file);
+ }
+
+ if (app_info)
+ {
+ GList l;
+
+ l.data = (char *)uri;
+ l.next = l.prev = NULL;
+ res = g_app_info_launch_uris (app_info, &l, launch_context, error);
+ g_object_unref (app_info);
+ }
}
#ifdef G_OS_UNIX
@@ -1148,7 +1153,7 @@ launch_default_for_uri_default_handler_cb (GObject *object,
GError *error = NULL;
app_info = g_file_query_default_handler_finish (file, result, &error);
- if (app_info)
+ if (app_info && !glib_is_force_use_portal())
launch_default_for_uri_launch_uris (g_steal_pointer (&task), g_steal_pointer (&app_info));
else
launch_default_for_uri_portal_open_uri (g_steal_pointer (&task), g_steal_pointer (&error));
diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c
index b002e93..f4da449 100644
--- a/gio/gportalsupport.c
+++ b/gio/gportalsupport.c
@@ -29,6 +29,8 @@ static gboolean use_portal;
static gboolean network_available;
static gboolean dconf_access;
+static gboolean force_use_portal;
+
#ifdef G_PORTAL_SUPPORT_TEST
static const char *snapctl = "snapctl";
#else
@@ -70,6 +72,8 @@ sandbox_info_read (void)
if (!g_once_init_enter (&sandbox_info_is_read))
return;
+ force_use_portal = FALSE;
+
sandbox_type = glib_get_sandbox_type ();
switch (sandbox_type)
@@ -124,12 +128,16 @@ sandbox_info_read (void)
case G_SANDBOX_TYPE_UNKNOWN:
{
const char *var;
+ const char *env_var;
var = g_getenv ("GIO_USE_PORTALS");
if (var && var[0] == '1')
use_portal = TRUE;
network_available = TRUE;
dconf_access = TRUE;
+ env_var = g_getenv ("GLIB_FORCE_USE_PORTAL");
+ if (env_var && env_var[0] == '1' && use_portal)
+ force_use_portal = TRUE;
}
break;
}
@@ -176,3 +184,10 @@ glib_has_dconf_access_in_sandbox (void)
return dconf_access;
}
+
+gboolean
+glib_is_force_use_portal (void)
+{
+ read_flatpak_info ();
+ return force_use_portal;
+}
diff --git a/gio/gportalsupport.h b/gio/gportalsupport.h
index 5fe5d82..e26fbbe 100644
--- a/gio/gportalsupport.h
+++ b/gio/gportalsupport.h
@@ -28,6 +28,7 @@ G_BEGIN_DECLS
gboolean glib_should_use_portal (void);
gboolean glib_network_available_in_sandbox (void);
gboolean glib_has_dconf_access_in_sandbox (void);
+gboolean glib_is_force_use_portal (void);
G_END_DECLS

View File

@ -0,0 +1,142 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Fri, 1 Dec 2023 17:37:45 +0800
Subject: =?utf-8?b?5re75YqgR0xJQl9VU0VfS1lMSU5fUFJPQ0VTU19NQU5BR0VS546v5aKD?=
=?utf-8?b?5Y+Y6YeP77yM5b2TR0xJQl9VU0VfS1lMSU5fUFJPQ0VTU19NQU5BR0VSPTHml7Y=?=
=?utf-8?b?77yMZ19hcHBfaW5mb19sYXVuY2hfdXJpcygp5ZKMZ19hcHBfaW5mb19sYXVuY2hf?=
=?utf-8?b?dXJpc19hc3luYygp5Lya6LWwa3lsaW4tcHJvY2Vzcy1tYW5hZ2Vy5o+Q5L6b55qE?=
=?utf-8?b?ZGJ1c+aOpeWPo+aJk+W8gOW6lOeUqOaIluiAheaWh+S7tg==?=
---
gio/gdesktopappinfo.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
gio/gportalsupport.c | 12 ++++++++++++
gio/gportalsupport.h | 1 +
3 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index e2177b8..32132f2 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -57,6 +57,7 @@
#include "gappinfoprivate.h"
#include "glocalfilemonitor.h"
#include "gutilsprivate.h"
+#include "gportalsupport.h"
#ifdef G_OS_UNIX
#include "gdocumentportal.h"
@@ -3262,6 +3263,33 @@ launch_uris_with_dbus (GDesktopAppInfo *info,
g_variant_dict_clear (&dict);
}
+static void
+g_desktop_app_info_launch_with_kylin_process_manager (GDesktopAppInfo *info,
+ GDBusConnection *session_bus,
+ GList *uris,
+ GAppLaunchContext *launch_context,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ const gchar *cmd = g_app_info_get_commandline (G_DESKTOP_APP_INFO (info));
+ gchar *args = g_strdup (cmd);
+ GList *iter = uris;
+ GVariantBuilder builder;
+ while (iter) {
+ char *uri = iter->data;
+ char *tmp_args = g_strconcat (args, " ", uri, NULL);
+ g_free (args);
+ args = tmp_args;
+ iter = iter->next;
+ }
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add (&builder, "s", args);
+ g_free (args);
+ g_dbus_connection_call (session_bus, "com.kylin.ProcessManager", "/com/kylin/ProcessManager/AppLauncher", "com.kylin.ProcessManager.AppLauncher", "RunCommand",
+ g_variant_builder_end (&builder), NULL, G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data);
+}
+
static gboolean
g_desktop_app_info_launch_uris_with_dbus (GDesktopAppInfo *info,
GDBusConnection *session_bus,
@@ -3314,10 +3342,16 @@ g_desktop_app_info_launch_uris_internal (GAppInfo *appinfo,
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
GDBusConnection *session_bus;
gboolean success = TRUE;
+ gboolean use_kylin_process_manager = glib_should_use_kylin_process_manager ();
session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
- if (session_bus && info->app_id)
+ if (session_bus && use_kylin_process_manager)
+ {
+ g_desktop_app_info_launch_with_kylin_process_manager(info, session_bus, uris, launch_context,
+ NULL, NULL, NULL);
+ }
+ else if (session_bus && info->app_id)
/* This is non-blocking API. Similar to launching via fork()/exec()
* we don't wait around to see if the program crashed during startup.
* This is what startup-notification's job is...
@@ -3418,10 +3452,16 @@ launch_uris_bus_get_cb (GObject *object,
GCancellable *cancellable = g_task_get_cancellable (task);
GDBusConnection *session_bus;
GError *local_error = NULL;
+ gboolean use_kylin_process_manager = glib_should_use_kylin_process_manager ();
session_bus = g_bus_get_finish (result, NULL);
- if (session_bus && info->app_id)
+ if (session_bus && use_kylin_process_manager)
+ {
+ g_desktop_app_info_launch_with_kylin_process_manager(info, session_bus, data->uris, data->context,
+ cancellable, launch_uris_with_dbus_cb, g_steal_pointer (&task));
+ }
+ else if (session_bus && info->app_id)
{
/* FIXME: The g_document_portal_add_documents() function, which is called
* from the g_desktop_app_info_launch_uris_with_dbus() function, still
diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c
index f4da449..37e9196 100644
--- a/gio/gportalsupport.c
+++ b/gio/gportalsupport.c
@@ -30,6 +30,7 @@ static gboolean network_available;
static gboolean dconf_access;
static gboolean force_use_portal;
+static gboolean use_kylin_process_manager;
#ifdef G_PORTAL_SUPPORT_TEST
static const char *snapctl = "snapctl";
@@ -129,6 +130,11 @@ sandbox_info_read (void)
{
const char *var;
const char *env_var;
+ const char *kylin_var;
+
+ kylin_var = g_getenv ("GLIB_USE_KYLIN_PROCESS_MANAGER");
+ if (kylin_var && kylin_var[0] == '1')
+ use_kylin_process_manager = TRUE;
var = g_getenv ("GIO_USE_PORTALS");
if (var && var[0] == '1')
@@ -191,3 +197,9 @@ glib_is_force_use_portal (void)
read_flatpak_info ();
return force_use_portal;
}
+
+gboolean glib_should_use_kylin_process_manager (void)
+{
+ read_flatpak_info ();
+ return use_kylin_process_manager;
+}
diff --git a/gio/gportalsupport.h b/gio/gportalsupport.h
index e26fbbe..9a07de2 100644
--- a/gio/gportalsupport.h
+++ b/gio/gportalsupport.h
@@ -29,6 +29,7 @@ gboolean glib_should_use_portal (void);
gboolean glib_network_available_in_sandbox (void);
gboolean glib_has_dconf_access_in_sandbox (void);
gboolean glib_is_force_use_portal (void);
+gboolean glib_should_use_kylin_process_manager (void);
G_END_DECLS

View File

@ -0,0 +1,31 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Thu, 23 May 2024 16:29:36 +0800
Subject: =?utf-8?b?5pS55Yqo6K+05piO77ya6YCC6YWN6bqS6bqf57O757uf5paH5Lu25aSn?=
=?utf-8?b?5bCP55qE6K6h566X6KeE6IyD77yIWELku6UxMDI06L+b5Yi277yJ77yMZ2xpYg==?=
=?utf-8?b?5Y6f5pys5a6e546w77yIWELku6UxMDAw6L+b5Yi277ybWGlC5LulMTAyNOi/mw==?=
=?utf-8?b?5Yi277yJICogQlVH5Y+377yaMTU2NTI4IOOAkEdUS+mcgOaxgjE5MjU044CR44CQ?=
=?utf-8?b?5paH5qGj5p+l55yL5Zmo44CR6YCa6L+H5paH5qGj5p+l55yL5Zmo5omT5byA5paH?=
=?utf-8?b?5Lu25YiX6KGo55qE5paH5Lu25aSn5bCP5LiO5bGe5oCn6YeM55qE5aSn5bCP5LiN?=
=?utf-8?b?5LiA6Ie0IDEwMzY1MiDjgJDnlKjkvosyNDI0NTbjgJHjgJDlvZLmoaPnrqHnkIY=?=
=?utf-8?b?5Zmo44CR5b2S5qGj5paH5Lu2LeaJk+W8gOeql+WPo+aYvuekuuaWh+S7tuWkpw==?=
=?utf-8?b?5bCP5LiO5paH5Lu2566h55CG5Zmo5LiN5LiA6Ie0ICog6ZyA5rGCL+S7u+WKoQ==?=
=?utf-8?b?5Y+377yaICog5YW25LuW5pS55Yqo77yaICog5b2x5ZON5Z+f6K+05piO77ya5b2x?=
=?utf-8?b?5ZON5paH5Lu244CB56OB55uY5aSn5bCP5o2i566X57uT5p6c55qE5pi+56S6?=
---
glib/gutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/glib/gutils.c b/glib/gutils.c
index bb88c76..09d6c4d 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2860,7 +2860,7 @@ g_nullify_pointer (gpointer *nullify_location)
*nullify_location = NULL;
}
-#define KILOBYTE_FACTOR (G_GOFFSET_CONSTANT (1000))
+#define KILOBYTE_FACTOR (G_GOFFSET_CONSTANT (1024))
#define MEGABYTE_FACTOR (KILOBYTE_FACTOR * KILOBYTE_FACTOR)
#define GIGABYTE_FACTOR (MEGABYTE_FACTOR * KILOBYTE_FACTOR)
#define TERABYTE_FACTOR (GIGABYTE_FACTOR * KILOBYTE_FACTOR)

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 0ad8306..65da312 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -899,6 +899,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;
}
@@ -1016,6 +1026,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

@ -0,0 +1,39 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Thu, 23 May 2024 16:27:01 +0800
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 112517c..c2928a2 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1997,6 +1997,7 @@ g_local_file_trash (GFile *file,
GVfsClass *class;
GVfs *vfs;
int errsv;
+ gboolean is_local_file_in_usershare = FALSE;
GError *set_contents_error;
FILE *info_file;
@@ -2053,7 +2054,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;
@@ -2092,7 +2094,7 @@ g_local_file_trash (GFile *file,
return FALSE;
}
- if (ignore_trash_path (topdir))
+ if (ignore_trash_path (topdir) && !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

@ -0,0 +1,45 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Tue, 5 Dec 2023 15:31:42 +0800
Subject: =?utf-8?b?57un57ut6YCC6YWNa3lsaW4tcHJvY2Vzcy1tYW5hZ2Vy55qEZGJ1cw==?=
=?utf-8?b?5o6l5Y+j77yM5bCd6K+V5L+u5aSN57yW56CB6Zeu6aKY?=
---
gio/gdesktopappinfo.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 17fe37f..9bb8248 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -3272,21 +3272,21 @@ g_desktop_app_info_launch_with_kylin_process_manager (GDesktopAppInfo *info,
GAsyncReadyCallback callback,
gpointer user_data)
{
- const gchar *cmd = g_app_info_get_executable (G_DESKTOP_APP_INFO (info));
- gchar *args = g_strdup (cmd);
- GList *iter = uris;
+ const gchar *path = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info));
GVariantBuilder builder;
+ GList *iter;
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add (&builder, "s", path);
+ g_variant_builder_open (&builder, G_VARIANT_TYPE_STRING_ARRAY);
+ iter = uris;
while (iter) {
char *uri = iter->data;
- char *tmp_args = g_strconcat (args, " ", uri, NULL);
- g_free (args);
- args = tmp_args;
+ g_variant_builder_add (&builder, "s", uri);
iter = iter->next;
}
- g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add (&builder, "s", args);
- g_free (args);
- g_dbus_connection_call (session_bus, "com.kylin.ProcessManager", "/com/kylin/ProcessManager/AppLauncher", "com.kylin.ProcessManager.AppLauncher", "RunCommand",
+ g_variant_builder_close (&builder);
+
+ g_dbus_connection_call (session_bus, "com.kylin.ProcessManager", "/com/kylin/ProcessManager/AppLauncher", "com.kylin.ProcessManager.AppLauncher", "LaunchAppWithArguments",
g_variant_builder_end (&builder), NULL, G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data);
}

View File

@ -0,0 +1,22 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Mon, 4 Dec 2023 16:47:37 +0800
Subject: =?utf-8?b?6YCC6YWNa3lsaW4tcHJvY2Vzcy1tYW5hZ2Vy55qEZGJ1c+aOpeWPow==?=
=?utf-8?b?6Kej5p6Q6KeE5YiZ?=
---
gio/gdesktopappinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 32132f2..17fe37f 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -3272,7 +3272,7 @@ g_desktop_app_info_launch_with_kylin_process_manager (GDesktopAppInfo *info,
GAsyncReadyCallback callback,
gpointer user_data)
{
- const gchar *cmd = g_app_info_get_commandline (G_DESKTOP_APP_INFO (info));
+ const gchar *cmd = g_app_info_get_executable (G_DESKTOP_APP_INFO (info));
gchar *args = g_strdup (cmd);
GList *iter = uris;
GVariantBuilder builder;

16
debian/patches/series vendored
View File

@ -4,7 +4,6 @@ girparser-Make-sizes-in-integer_aliases-more-obviously-co.patch
girparser-Adjust-signedness-to-avoid-compiler-warnings.patch
girparser-Add-a-pseudo-doc-comment-for-signedness.patch
01_gettext-desktopfiles.patch
debian/02_gettext-desktopfiles-ubuntu.patch
debian/03_disble_glib_compile_schemas_warning.patch
debian/gdesktopappinfo-Try-using-x-terminal-emulator-for-Termina.patch
workarounds/timer-test-use-volatile-for-locals.patch
@ -37,3 +36,18 @@ CVE-2024-34397-14.patch
CVE-2024-34397-15.patch
CVE-2024-34397-16.patch
CVE-2024-34397-regression.patch
166960.patch
169359-U.patch
FIX-182831-U.patch
GLIB_FORCE_USE_PORTAL-GTK_USE_PORTAL-1-GLIB_FORCE_USE_POR.patch
GLIB_USE_KYLIN_PROCESS_MANAGER-GLIB_USE_KYLIN_PROCESS_MAN.patch
kylin-process-manager-dbus.patch
tryfix-I8OAV1-kylin-process-manager.patch
.patch
5c52117c4ae9367c96609915fde5a280101a9b0b-GLIB_FORCE_USE_P.patch
kylin-process-manager-dbus-1.patch
vfat-4G.patch
fix-trash-issue-in-data-usershare.patch
user-directory-i18n.patch
XB-1024-glib-XB-1000-XiB-1024-BUG-156528-GTK-19254-103652.patch
-1.patch

View File

@ -0,0 +1,27 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Thu, 14 Dec 2023 17:19:57 +0800
Subject: =?utf-8?b?dHJ5Zml4ICNJOE9BVjEg5Y246L29a3lsaW4tcHJvY2Vzcy1tYW5hZ2Vy?=
=?utf-8?b?5ZCO5peg5rOV6YCa6L+H5qGM6Z2i5Zu+5qCH44CB5byA5aeL6I+c5Y2V44CB5Lu7?=
=?utf-8?b?5Yqh5qCP5Zu+5qCH5omT5byA?=
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
确保使用gio接口的部分能够正常打开
---
gio/gportalsupport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c
index 37e9196..d82d763 100644
--- a/gio/gportalsupport.c
+++ b/gio/gportalsupport.c
@@ -133,7 +133,7 @@ sandbox_info_read (void)
const char *kylin_var;
kylin_var = g_getenv ("GLIB_USE_KYLIN_PROCESS_MANAGER");
- if (kylin_var && kylin_var[0] == '1')
+ if (kylin_var && kylin_var[0] == '1' && g_file_test ("/usr/bin/kylin-process-manager", G_FILE_TEST_EXISTS))
use_kylin_process_manager = TRUE;
var = g_getenv ("GIO_USE_PORTALS");

View File

@ -0,0 +1,73 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Thu, 23 May 2024 16:28:19 +0800
Subject: user-directory-i18n
---
gio/glocalfileinfo.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 2df7c91..0357d43 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -124,6 +124,9 @@ static GHashTable *gid_cache = NULL;
#endif /* !G_OS_WIN32 */
+char* update_xdg_directory_display_name (const char *path,
+ char *display_name);
+
char *
_g_local_file_info_create_etag (GLocalFileStat *statbuf)
{
@@ -1781,6 +1784,7 @@ _g_local_file_info_get_nostat (GFileInfo *info,
G_FILE_ATTRIBUTE_ID_STANDARD_DISPLAY_NAME))
{
char *display_name = g_filename_display_basename (path);
+ char *xdg_display_name = NULL;
/* look for U+FFFD REPLACEMENT CHARACTER */
if (strstr (display_name, "\357\277\275") != NULL)
@@ -1789,7 +1793,9 @@ _g_local_file_info_get_nostat (GFileInfo *info,
display_name = g_strconcat (display_name, _(" (invalid encoding)"), NULL);
g_free (p);
}
- g_file_info_set_display_name (info, display_name);
+ xdg_display_name = update_xdg_directory_display_name (path, display_name);
+ g_file_info_set_display_name (info, xdg_display_name);
+ g_free (xdg_display_name);
g_free (display_name);
}
@@ -1869,6 +1875,31 @@ get_icon_name (const char *path,
return name;
}
+char *update_xdg_directory_display_name (const char *path,
+ char *display_name)
+{
+ char *retval = g_strdup (display_name);
+ if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
+ {
+ retval = g_strdup (_("Desktop"));
+ } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS)) == 0) {
+ retval = g_strdup (_("Documents"));
+ } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD)) == 0) {
+ retval = g_strdup (_("Download"));
+ } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_MUSIC)) == 0) {
+ retval = g_strdup (_("Music"));
+ } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_PICTURES)) == 0) {
+ retval = g_strdup (_("Pictures"));
+ } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_PUBLIC_SHARE)) == 0) {
+ retval = g_strdup (_("Public Share"));
+ } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES)) == 0) {
+ retval = g_strdup (_("Templates"));
+ } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS)) == 0) {
+ retval = g_strdup (_("Videos"));
+ }
+ return retval;
+}
+
static GIcon *
get_icon (const char *path,
const char *content_type,

119
debian/patches/vfat-4G.patch vendored Normal file
View File

@ -0,0 +1,119 @@
From: Yue-Lan <lanyue@kylinos.cn>
Date: Thu, 23 May 2024 16:25:49 +0800
Subject: =?utf-8?b?dmZhdOaWh+S7tui2hei/hzRH56e75Yqo5oiW5aSN5Yi255u05o6l5oql?=
=?utf-8?b?6ZSZ?=
---
gio/gfile.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/gio/gfile.c b/gio/gfile.c
index d52262f..e081bca 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -55,6 +55,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"
@@ -390,6 +393,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)
@@ -3702,10 +3728,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;
@@ -3906,10 +3954,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;