glib2.0/debian/patches/fix-trash-issue-in-data-use...

40 lines
1.2 KiB
Diff

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"));