Accepting request 573527 from home:iznogood

- Update to version 1.34.2:
  + Recent: Prevent crash when recent file changed.
  + Trash: Fix trash::orig-path for relative paths.
  + Mtp:
    - Handle read-past-EOF ourselves to prevent hangs.
    - Fix volume removal with current udev behavior.
  + Gphoto2: Fix volume removal with current udev behavior.
  + Updated translations.
- Drop gvfs-fix-mtp-volume-removal.patch and
  gvfs-mtp-handle-read-past-eof.patch: Fixed upstream.

OBS-URL: https://build.opensuse.org/request/show/573527
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gvfs?expand=0&rev=300
This commit is contained in:
Dominique Leuenberger 2018-02-07 11:46:47 +00:00 committed by Git OBS Bridge
parent b92b5d8eb8
commit 3463bc6de1
6 changed files with 20 additions and 236 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ef9b2aec234004271a575118a0e35b3c36ce3309e5f9da109635651843372b4
size 1825380

3
gvfs-1.34.2.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:60d3c7eaf3dc697653b330b55b806ab0a59424030954628eb5ed88e8ea3a9669
size 1822024

View File

@ -1,164 +0,0 @@
From 4fe3b0f8d24851145b5ceae10eb3181b2340466b Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Wed, 25 Oct 2017 20:28:22 +0200
Subject: mtp: Fix volume removal with current udev behavior
UDev events for devices without ID_MTP_DEVICE property are ignored.
Although ID_MTP_DEVICE seems don't have to be set for device when removing
and thus the volume is not removed. Let's ignore ID_MTP_DEVICE when removing.
https://bugzilla.gnome.org/show_bug.cgi?id=789491
---
monitor/mtp/gmtpvolumemonitor.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/monitor/mtp/gmtpvolumemonitor.c b/monitor/mtp/gmtpvolumemonitor.c
index 50e37cf..bfd9e29 100644
--- a/monitor/mtp/gmtpvolumemonitor.c
+++ b/monitor/mtp/gmtpvolumemonitor.c
@@ -208,17 +208,12 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
g_debug ("on_uevent: action=%s, device=%s", action, g_udev_device_get_device_file(device));
- /* filter out uninteresting events */
- if (!g_udev_device_has_property (device, "ID_MTP_DEVICE"))
- {
- g_debug ("on_uevent: discarding, not ID_MTP");
- return;
- }
-
- if (strcmp (action, "add") == 0)
- gudev_add_device (monitor, device, TRUE);
- else if (strcmp (action, "remove") == 0)
- gudev_remove_device (monitor, device);
+ if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_MTP_DEVICE"))
+ gudev_add_device (monitor, device, TRUE);
+ else if (g_strcmp0 (action, "remove") == 0 && g_udev_device_get_device_file (device) != NULL)
+ gudev_remove_device (monitor, device);
+ else
+ g_debug ("on_uevent: discarding");
}
static void
--
cgit v0.12
From bcd2a7ac00b5d6cd82e8ddfe9481da8edfe59e6a Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Fri, 27 Oct 2017 10:11:20 +0200
Subject: gphoto2: Fix volume removal with current udev behavior
UDev events for devices without ID_GPHOTO2 property are ignored.
Although ID_GPHOTO2 seems don't have to be set for device when removing
and thus the volume is not removed. Let's ignore ID_GPHOTO2 when removing.
https://bugzilla.gnome.org/show_bug.cgi?id=789491
---
monitor/gphoto2/ggphoto2volumemonitor.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c
index f4fae8b..06e07ab 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -246,17 +246,12 @@ on_uevent (GUdevClient *client,
/* g_debug ("on_uevent: action=%s, device=%s", action, g_udev_device_get_device_file(device)); */
- /* filter out uninteresting events */
- if (!g_udev_device_has_property (device, "ID_GPHOTO2"))
- {
- /* g_debug ("on_uevent: discarding, not ID_GPHOTO2"); */
- return;
- }
-
- if (strcmp (action, "add") == 0)
- gudev_add_camera (monitor, device, TRUE);
- else if (strcmp (action, "remove") == 0)
- gudev_remove_camera (monitor, device);
+ if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_GPHOTO2"))
+ gudev_add_camera (monitor, device, TRUE);
+ else if (g_strcmp0 (action, "remove") == 0 && g_udev_device_get_device_file (device) != NULL)
+ gudev_remove_camera (monitor, device);
+ else
+ g_debug ("on_uevent: discarding");
}
/* Find all attached gphoto supported cameras; this is called on startup
--
cgit v0.12
From 9bf86aaf229ecbf82777958d55e29ec0d3a2f273 Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Tue, 31 Oct 2017 17:31:05 +0100
Subject: monitor: Remove device file checks
The device file checks were added by mistake and it is not clear whether
it can't have some side-effect. Let's remove them and use g_strcmp0 for
sysfs path comparison for sure...
https://bugzilla.gnome.org/show_bug.cgi?id=789491
---
monitor/gphoto2/ggphoto2volume.c | 2 +-
monitor/gphoto2/ggphoto2volumemonitor.c | 2 +-
monitor/mtp/gmtpvolume.c | 2 +-
monitor/mtp/gmtpvolumemonitor.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/monitor/gphoto2/ggphoto2volume.c b/monitor/gphoto2/ggphoto2volume.c
index c1be77e..21e318b 100644
--- a/monitor/gphoto2/ggphoto2volume.c
+++ b/monitor/gphoto2/ggphoto2volume.c
@@ -218,7 +218,7 @@ g_gphoto2_volume_has_path (GGPhoto2Volume *volume,
G_LOCK (gphoto2_volume);
res = FALSE;
if (gphoto2_volume->device != NULL)
- res = strcmp (g_udev_device_get_sysfs_path (gphoto2_volume->device), sysfs_path) == 0;
+ res = g_strcmp0 (g_udev_device_get_sysfs_path (gphoto2_volume->device), sysfs_path) == 0;
G_UNLOCK (gphoto2_volume);
return res;
}
diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c
index 06e07ab..83340a2 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -248,7 +248,7 @@ on_uevent (GUdevClient *client,
if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_GPHOTO2"))
gudev_add_camera (monitor, device, TRUE);
- else if (g_strcmp0 (action, "remove") == 0 && g_udev_device_get_device_file (device) != NULL)
+ else if (g_strcmp0 (action, "remove") == 0)
gudev_remove_camera (monitor, device);
else
g_debug ("on_uevent: discarding");
diff --git a/monitor/mtp/gmtpvolume.c b/monitor/mtp/gmtpvolume.c
index cfd7759..681029f 100644
--- a/monitor/mtp/gmtpvolume.c
+++ b/monitor/mtp/gmtpvolume.c
@@ -209,7 +209,7 @@ g_mtp_volume_has_path (GMtpVolume *volume,
G_LOCK (mtp_volume);
res = FALSE;
if (mtp_volume->device != NULL)
- res = strcmp (g_udev_device_get_sysfs_path (mtp_volume->device), sysfs_path) == 0;
+ res = g_strcmp0 (g_udev_device_get_sysfs_path (mtp_volume->device), sysfs_path) == 0;
G_UNLOCK (mtp_volume);
return res;
}
diff --git a/monitor/mtp/gmtpvolumemonitor.c b/monitor/mtp/gmtpvolumemonitor.c
index bfd9e29..1e73db7 100644
--- a/monitor/mtp/gmtpvolumemonitor.c
+++ b/monitor/mtp/gmtpvolumemonitor.c
@@ -210,7 +210,7 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_MTP_DEVICE"))
gudev_add_device (monitor, device, TRUE);
- else if (g_strcmp0 (action, "remove") == 0 && g_udev_device_get_device_file (device) != NULL)
+ else if (g_strcmp0 (action, "remove") == 0)
gudev_remove_device (monitor, device);
else
g_debug ("on_uevent: discarding");
--
cgit v0.12

View File

@ -1,62 +0,0 @@
From 091ac25d59d0dc0f5fed17510b0593bcd86e9fc9 Mon Sep 17 00:00:00 2001
From: Philip Langdale <philipl@overt.org>
Date: Fri, 10 Nov 2017 07:59:42 -0800
Subject: mtp: Handle read-past-EOF in GetPartialObject(64)
ourselves
Up until very recently, the Android MTP driver did not do bounds checking
on reads past EOF, leading to undefined behaviour, which includes
hanging the transfer on some devices.
According to Google engineers, this is fixed in the kernels used by
the Pixel and Pixel 2 (and this has been verified in testing), but
that basically means that every other Android device in existence has
this bug, and is unlikely to ever be fixed.
So, we need to enforce POSIX semantics ourselves and truncate reads
past EOF. libmtp has implemented a check, but we should validate as
well so that we have working behaviour without requiring a libmtp
update.
https://bugzilla.gnome.org/show_bug.cgi?id=784477
---
daemon/gvfsbackendmtp.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index 2a418a2a..a606ec2c 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -2444,6 +2444,21 @@ do_read (GVfsBackend *backend,
goto exit;
}
+ /*
+ * Almost all android devices have a bug where they do not enforce
+ * POSIX semantics for read past EOF, leading to undefined
+ * behaviour including device-side hangs. We'd better handle it
+ * here.
+ */
+ if (offset >= handle->size) {
+ g_debug ("(II) skipping read with offset past EOF\n");
+ actual = 0;
+ goto finished;
+ } else if (offset + bytes_requested > handle->size) {
+ g_debug ("(II) reducing bytes_requested to avoid reading past EOF\n");
+ bytes_requested = handle->size - offset;
+ }
+
unsigned char *temp;
int ret = LIBMTP_GetPartialObject (G_VFS_BACKEND_MTP (backend)->device, id, offset,
bytes_requested, &temp, &actual);
@@ -2464,6 +2479,7 @@ do_read (GVfsBackend *backend,
memcpy (buffer, bytes->data + offset, actual);
}
+ finished:
handle->offset = offset + actual;
g_vfs_job_read_set_size (job, actual);
g_vfs_job_succeeded (G_VFS_JOB (job));
--
2.15.0

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Tue Feb 6 20:30:28 UTC 2018 - bjorn.lie@gmail.com
- Update to version 1.34.2:
+ Recent: Prevent crash when recent file changed.
+ Trash: Fix trash::orig-path for relative paths.
+ Mtp:
- Handle read-past-EOF ourselves to prevent hangs.
- Fix volume removal with current udev behavior.
+ Gphoto2: Fix volume removal with current udev behavior.
+ Updated translations.
- Drop gvfs-fix-mtp-volume-removal.patch and
gvfs-mtp-handle-read-past-eof.patch: Fixed upstream.
-------------------------------------------------------------------
Wed Jan 17 07:47:46 UTC 2018 - qzheng@suse.com
- Enable libnfs support also on SLE: BuildRequire pkgconfig(libnfs)

View File

@ -19,7 +19,7 @@
%define with_udisks2 1
%define with_cdda 1
Name: gvfs
Version: 1.34.1
Version: 1.34.2
Release: 0
Summary: Virtual File System functionality for GLib
License: LGPL-2.0+ AND GPL-3.0
@ -27,10 +27,7 @@ Group: Development/Libraries/C and C++
Url: http://www.gnome.org
Source0: http://download.gnome.org/sources/gvfs/1.34/%{name}-%{version}.tar.xz
Source99: baselibs.conf
# PATCH-FIX-UPSTREAM gvfs-fix-mtp-volume-removal.patch bgo#789491 zaitor@opensuse.org -- Fix various mtp issues with volume management
Patch0: gvfs-fix-mtp-volume-removal.patch
# PATCH-FIX-UPSTREAM gvfs-mtp-handle-read-past-eof.patch boo#1069030 bgo#784477 mgorse@suse.com -- fix hang when transferring on some Android devices.
Patch1: gvfs-mtp-handle-read-past-eof.patch
# PATCH-FEATURE-SLE gvfs-nvvfs.patch ksamrat@novell.com -- Provides gvfs backend for novell nautilus plugin
Patch5: gvfs-nvvfs.patch
# PATCH-FEATURE-SLE gvfs-nds.patch ksamrat@novell.com -- Provides NDS browsing for nautilus
@ -169,8 +166,6 @@ gvfs plugins.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%if !0%{?is_opensuse}
translation-update-upstream
%patch5 -p1