From 4100e166443dabffbc041f31446372263cd39e4e Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Fri, 23 Oct 2015 09:46:09 +0200 Subject: [PATCH] google: Fail in-fs copy/move if it leads to display name loss --- ...s-copy-move-if-it-leads-to-display-n.patch | 56 +++++++++++++++++++ gvfs.spec | 10 +++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 0001-google-Fail-in-fs-copy-move-if-it-leads-to-display-n.patch diff --git a/0001-google-Fail-in-fs-copy-move-if-it-leads-to-display-n.patch b/0001-google-Fail-in-fs-copy-move-if-it-leads-to-display-n.patch new file mode 100644 index 0000000..5afebe8 --- /dev/null +++ b/0001-google-Fail-in-fs-copy-move-if-it-leads-to-display-n.patch @@ -0,0 +1,56 @@ +From d236257299344207736086400960b0add2c1200b Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Mon, 19 Oct 2015 13:48:46 +0200 +Subject: [PATCH] google: Fail in-fs copy/move if it leads to display name loss + +Complicated file name handling on google backend leads to display name +loss if in-fs copy and move operation is proceeded e.g. using Nautilus. +Proper fix will require larger changes for the whole platform. Therefore +fail the job preferably to avoid display name loss... + +https://bugzilla.gnome.org/show_bug.cgi?id=755701 +--- + daemon/gvfsbackendgoogle.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c +index 0acec9a..59e2dfe 100644 +--- a/daemon/gvfsbackendgoogle.c ++++ b/daemon/gvfsbackendgoogle.c +@@ -1192,6 +1192,22 @@ g_vfs_backend_google_copy (GVfsBackend *_self, + } + } + ++ etag = gdata_entry_get_etag (source_entry); ++ id = gdata_entry_get_id (source_entry); ++ summary = gdata_entry_get_summary (source_entry); ++ ++ /* Fail the job if copy/move operation leads to display name loss. ++ * Use G_IO_ERROR_FAILED instead of _NOT_SUPPORTED to avoid r/w fallback. ++ * See: https://bugzilla.gnome.org/show_bug.cgi?id=755701 */ ++ if (g_strcmp0 (id, destination_basename) == 0) ++ { ++ g_vfs_job_failed_literal (G_VFS_JOB (job), ++ G_IO_ERROR, ++ G_IO_ERROR_FAILED, ++ _("Operation unsupported")); ++ goto out; ++ } ++ + if (destination_not_directory) + { + g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY, _("The file is not a directory")); +@@ -1230,10 +1246,6 @@ g_vfs_backend_google_copy (GVfsBackend *_self, + } + } + +- etag = gdata_entry_get_etag (source_entry); +- id = gdata_entry_get_id (source_entry); +- summary = gdata_entry_get_summary (source_entry); +- + source_entry_type = G_OBJECT_TYPE (source_entry); + dummy_source_entry = g_object_new (source_entry_type, + "etag", etag, +-- +2.5.0 + diff --git a/gvfs.spec b/gvfs.spec index 9cce433..f60f60c 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -3,7 +3,7 @@ Name: gvfs Version: 1.26.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Backends for the gio framework in GLib License: GPLv3 and LGPLv2+ and BSD and MPLv2.0 @@ -13,6 +13,9 @@ Source0: http://download.gnome.org/sources/gvfs/1.26/gvfs-%{version}.tar.xz # http://bugzilla.gnome.org/show_bug.cgi?id=567235 Patch0: gvfs-archive-integration.patch +# Backported from upstream +Patch1: 0001-google-Fail-in-fs-copy-move-if-it-leads-to-display-n.patch + BuildRequires: pkgconfig BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: dbus-glib-devel @@ -184,6 +187,7 @@ the functionality of the installed gvfs package. %prep %setup -q %patch0 -p1 -b .archive-integration +%patch1 -p1 -b .google-fail-in-fs-copy # Needed for gvfs-0.2.1-archive-integration.patch autoreconf -fi @@ -375,6 +379,10 @@ killall -USR1 gvfsd >&/dev/null || : %{_datadir}/installed-tests %changelog + +* Fri Oct 23 2015 Ondrej Holy - 1.26.1.1-2 +- google: Fail in-fs copy/move if it leads to display name loss + * Thu Oct 15 2015 Kalev Lember - 1.26.1.1-1 - Update to 1.26.1.1