- More complete fix for DAV mount path prefix issues

This commit is contained in:
Tomas Bzatek 2009-08-13 14:16:57 +00:00
parent ba6e5eea9b
commit 391fb17122
3 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,14 @@
Index: client/gdaemonmount.c
===================================================================
--- trunk/client/gdaemonmount.c (revision 2378)
+++ trunk/client/gdaemonmount.c (working copy)
@@ -108,7 +108,8 @@
{
GDaemonMount *daemon_mount = G_DAEMON_MOUNT (mount);
- return g_daemon_file_new (daemon_mount->mount_info->mount_spec, "/");
+ return g_daemon_file_new (daemon_mount->mount_info->mount_spec,
+ daemon_mount->mount_info->mount_spec->mount_prefix);
}
static GIcon *

View File

@ -0,0 +1,85 @@
From 3e62465b2aee2ca71302f00ccf815a48e87626ee Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 13 Aug 2009 15:30:35 +0200
Subject: [PATCH] Always set mount prefix ending with path separator
Mount prefix should always end with path separator ("/") to prevent
duplicate mounts, which would only have different prefix strings
(e.g. one with "/subdir" and the other with "/subdir/").
---
common/gmountspec.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/common/gmountspec.c b/common/gmountspec.c
index d72e189..16c0e66 100644
--- a/common/gmountspec.c
+++ b/common/gmountspec.c
@@ -42,6 +42,19 @@ item_compare (const void *_a, const void *_b)
return strcmp (a->key, b->key);
}
+/*
+ * Ensure trailing "/" to avoid redirections and mount_spec duplication.
+ * Returns newly allocated string.
+ */
+static gchar *
+ensure_trailing_path_separator (const gchar *path)
+{
+ if (path == NULL || g_str_has_suffix (path, "/"))
+ return g_strdup (path);
+ else
+ return g_strconcat (path, "/", NULL);
+}
+
GMountSpec *
g_mount_spec_new (const char *type)
{
@@ -69,9 +82,14 @@ g_mount_spec_new_from_data (GArray *items,
spec->ref_count = 1;
spec->items = items;
if (mount_prefix == NULL)
- spec->mount_prefix = g_strdup ("/");
+ {
+ spec->mount_prefix = g_strdup ("/");
+ }
else
- spec->mount_prefix = mount_prefix;
+ {
+ spec->mount_prefix = ensure_trailing_path_separator (mount_prefix);
+ g_free (mount_prefix);
+ }
g_array_sort (spec->items, item_compare);
@@ -112,7 +130,7 @@ g_mount_spec_set_mount_prefix (GMountSpec *spec,
const char *mount_prefix)
{
g_free (spec->mount_prefix);
- spec->mount_prefix = g_strdup (mount_prefix);
+ spec->mount_prefix = ensure_trailing_path_separator (mount_prefix);
}
@@ -247,7 +265,8 @@ g_mount_spec_from_dbus (DBusMessageIter *iter)
spec = g_mount_spec_new (NULL);
g_free (spec->mount_prefix);
- spec->mount_prefix = mount_prefix;
+ spec->mount_prefix = ensure_trailing_path_separator (mount_prefix);
+ g_free (mount_prefix);
if (dbus_message_iter_get_arg_type (&spec_iter) != DBUS_TYPE_ARRAY ||
dbus_message_iter_get_element_type (&spec_iter) != DBUS_TYPE_STRUCT)
@@ -541,7 +560,8 @@ g_mount_spec_new_from_string (const gchar *str,
if (strcmp (tokens[0], "prefix") == 0)
{
g_free (item.key);
- mount_prefix = item.value;
+ mount_prefix = ensure_trailing_path_separator (item.value);
+ g_free (item.value);
}
else
{
--
1.6.4

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.3.4
Release: 4%{?dist}
Release: 5%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -38,6 +38,10 @@ Patch1: gvfs-archive-integration.patch
# Bad mount prefix stripping in g_daemon_file_get_path()
# http://bugzilla.gnome.org/show_bug.cgi?id=590862
Patch4: gvfs-1.3.4-dont-strip-mount-prefix-for-local-paths.patch
# GDaemonMount calculates wrong root path when mount_prefix is set
# http://bugzilla.gnome.org/show_bug.cgi?id=590730
Patch5: gvfs-1.3.5-gdaemonmount-root-path.patch
Patch6: gvfs-1.3.5-mountspec-prefix-ensure-ending-path-separator.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=497631
Patch8: gvfs-1.2.2-dnssd-deadlock.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=504339
@ -138,6 +142,8 @@ and iPod Touches to applications using gvfs.
%setup -q
%patch1 -p1 -b .archive-integration
%patch4 -p1 -b .mount-prefix
%patch5 -p1 -b .root-path
%patch6 -p1 -b .prefix-slash
%patch8 -p1 -b .dnssd-deadlock
%patch9 -p1 -b .sftp-timeout
%patch10 -p1 -b .afc
@ -295,6 +301,9 @@ update-desktop-database &> /dev/null ||:
%{_datadir}/gvfs/remote-volume-monitors/afc.monitor
%changelog
* Thu Aug 13 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.3.4-5
- More complete fix for DAV mount path prefix issues
* Tue Aug 11 2009 Bastien Nocera <bnocera@redhat.com> 1.3.4-4
- Fix crash on startup for the afc volume monitor