diff --git a/gvfs-1.4.3-smb-queryfs-old-samba.patch b/gvfs-1.4.3-smb-queryfs-old-samba.patch new file mode 100644 index 0000000..0399b5d --- /dev/null +++ b/gvfs-1.4.3-smb-queryfs-old-samba.patch @@ -0,0 +1,42 @@ +From dd3e17181854c91f7c9123360652ae2ec28ea03e Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Mon, 30 Nov 2009 15:24:10 +0100 +Subject: [PATCH] [SMB] Fix free space calculation for older samba servers + +Samba servers older than 3.0.28 report zero values. +--- + daemon/gvfsbackendsmb.c | 18 +++++++++++------- + 1 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c +index f53b8cb..88dac26 100644 +--- a/daemon/gvfsbackendsmb.c ++++ b/daemon/gvfsbackendsmb.c +@@ -1615,13 +1615,17 @@ do_query_fs_info (GVfsBackend *backend, + + if (res == 0) + { +- /* FIXME: inconsistent return values (libsmbclient-3.4.2) +- * - for linux samba hosts, f_frsize is zero and f_bsize is a real block size +- * - for some Windows hosts (XP), f_frsize and f_bsize should be multiplied to get real block size +- */ +- g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, st.f_bsize * st.f_blocks * ((st.f_frsize == 0) ? 1 : st.f_frsize)); +- g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, st.f_bsize * st.f_bfree * ((st.f_frsize == 0) ? 1 : st.f_frsize)); +- g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, st.f_flag & SMBC_VFS_FEATURE_RDONLY); ++ /* older samba versions ( < 3.0.28) return zero values in struct statvfs */ ++ if (st.f_blocks > 0) ++ { ++ /* FIXME: inconsistent return values (libsmbclient-3.4.2) ++ * - for linux samba hosts, f_frsize is zero and f_bsize is a real block size ++ * - for some Windows hosts (XP), f_frsize and f_bsize should be multiplied to get real block size ++ */ ++ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, st.f_bsize * st.f_blocks * ((st.f_frsize == 0) ? 1 : st.f_frsize)); ++ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, st.f_bsize * st.f_bfree * ((st.f_frsize == 0) ? 1 : st.f_frsize)); ++ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, st.f_flag & SMBC_VFS_FEATURE_RDONLY); ++ } + } + } + #endif +-- +1.6.5.2 + diff --git a/gvfs-1.5.2-fuse-timestamps.patch b/gvfs-1.5.2-fuse-timestamps.patch new file mode 100644 index 0000000..a7171eb --- /dev/null +++ b/gvfs-1.5.2-fuse-timestamps.patch @@ -0,0 +1,84 @@ +From 59bea4126cf23c575323c59a4cb1123f7cb44e2b Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Thu, 19 Nov 2009 14:48:56 +0000 +Subject: fuse: Fix setting timestamps + +We need to set time in seconds and microseconds separately. +Moreover, backends may not fully support setting all attributes +so don't report failure when at least one succeeded. + +At the moment, only SMB supports setting G_FILE_ATTRIBUTE_TIME_MODIFIED. +--- +diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c +index 6e82e15..3893937 100644 +--- a/client/gvfsfusedaemon.c ++++ b/client/gvfsfusedaemon.c +@@ -2083,40 +2083,53 @@ vfs_utimens (const gchar *path, const struct timespec tv [2]) + if (file) + { + guint64 atime; ++ guint32 atime_usec; + guint64 mtime; ++ guint32 mtime_usec; ++ GFileInfo *info; + + if (tv) + { +- atime = (guint64) tv [0].tv_sec * 1000000 + (guint64) tv [0].tv_nsec / (guint64) 1000; +- mtime = (guint64) tv [1].tv_sec * 1000000 + (guint64) tv [1].tv_nsec / (guint64) 1000; ++ atime = (guint64) tv [0].tv_sec; ++ atime_usec = (guint32) tv [0].tv_nsec / (guint32) 1000; ++ mtime = (guint64) tv [1].tv_sec; ++ mtime_usec = (guint32) tv [1].tv_nsec / (guint32) 1000; + } + else + { + struct timeval tiv; + + gettimeofday (&tiv, NULL); +- atime = (guint64) tiv.tv_sec * (guint64) 1000000 + (guint64) tiv.tv_usec; ++ atime = (guint64) tiv.tv_sec; ++ atime_usec = (guint32) tiv.tv_usec; + mtime = atime; ++ mtime_usec = atime_usec; + } + +- g_file_set_attribute (file, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, +- G_FILE_ATTRIBUTE_TYPE_UINT64, &atime, +- 0, NULL, &error); ++ info = g_file_info_new (); ++ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, mtime); ++ g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, mtime_usec); ++ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS, atime); ++ g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, atime_usec); + +- if (!error) +- { +- g_file_set_attribute (file, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, +- G_FILE_ATTRIBUTE_TYPE_UINT64, &mtime, +- 0, NULL, &error); +- } ++ g_file_set_attributes_from_info (file, info, 0, NULL, &error); + + if (error) + { +- result = -errno_from_error (error); ++ /* As long as not all backends support all attributes we set, ++ report failure only if neither mtime and atime have been set. */ ++ if (g_file_info_get_attribute_status (info, G_FILE_ATTRIBUTE_TIME_ACCESS) == G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING && ++ g_file_info_get_attribute_status (info, G_FILE_ATTRIBUTE_TIME_MODIFIED) == G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING) ++ { ++ /* Note: we only get first error from the attributes we try to set, might not be accurate ++ (a limitation of g_file_set_attributes_from_info()). */ ++ result = -errno_from_error (error); ++ } + g_error_free (error); + } + + g_object_unref (file); ++ g_object_unref (info); + } + else if (path_is_mount_list (path)) + { +-- +cgit v0.8.2 diff --git a/gvfs-1.5.2-metadata-gssize.patch b/gvfs-1.5.2-metadata-gssize.patch new file mode 100644 index 0000000..93a7d00 --- /dev/null +++ b/gvfs-1.5.2-metadata-gssize.patch @@ -0,0 +1,24 @@ +From f45b677201abb6b8471fa5bc935afda420c28c39 Mon Sep 17 00:00:00 2001 +From: Alexander Larsson +Date: Thu, 19 Nov 2009 10:53:10 +0000 +Subject: Don't store write() return val in unsigned variable + +The conversion to unsigned means we failed to recognize errors, +since if (ret < 0) was never hit. This is the suspected cause +for data loss in bug 598561. +--- +diff --git a/metadata/metabuilder.c b/metadata/metabuilder.c +index bffdd16..cca2443 100644 +--- a/metadata/metabuilder.c ++++ b/metadata/metabuilder.c +@@ -799,7 +799,7 @@ write_metadata (GString *out, + static gboolean + write_all_data_and_close (int fd, char *data, gsize len) + { +- gsize written; ++ gssize written; + gboolean res; + + res = FALSE; +-- +cgit v0.8.2 diff --git a/gvfs-1.5.2-metadata-mtime.patch b/gvfs-1.5.2-metadata-mtime.patch new file mode 100644 index 0000000..5c9f2fd --- /dev/null +++ b/gvfs-1.5.2-metadata-mtime.patch @@ -0,0 +1,25 @@ +From 32dc3707bbb93153f9bd3df32259b7bf0e9cd579 Mon Sep 17 00:00:00 2001 +From: Alexander Larsson +Date: Thu, 19 Nov 2009 10:56:44 +0000 +Subject: If there are no mtimes in the file, use 0 as mtime base + +Before we used to store -1 (0xffffffff) as the mtime base in this case. +This value is not used if there are no mtimes though, so this is more +like a cosmetic change. +--- +diff --git a/metadata/metabuilder.c b/metadata/metabuilder.c +index cca2443..e27d1d3 100644 +--- a/metadata/metabuilder.c ++++ b/metadata/metabuilder.c +@@ -940,7 +940,8 @@ metadata_create_static (MetaBuilder *builder, + + /* Store the base as the min value in use minus one so that + 0 is free to mean "not defined" */ +- time_t_min = time_t_min - 1; ++ if (time_t_min != 0) ++ time_t_min = time_t_min - 1; + + /* Pick the base as the minimum, unless that leads to + a 32bit overflow */ +-- +cgit v0.8.2 diff --git a/gvfs.spec b/gvfs.spec index e06d0ea..2b0564d 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -1,7 +1,7 @@ Summary: Backends for the gio framework in GLib Name: gvfs Version: 1.5.1 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -38,6 +38,10 @@ Patch1: gvfs-1.5.1-afc-remove-unreleased.patch # from upstream Patch2: gvfs-1.5.2-metadata-fix-rotated.patch Patch3: gvfs-1.5.2-metadata-fsync-directory.patch +Patch4: gvfs-1.4.3-smb-queryfs-old-samba.patch +Patch5: gvfs-1.5.2-metadata-gssize.patch +Patch6: gvfs-1.5.2-metadata-mtime.patch +Patch7: gvfs-1.5.2-fuse-timestamps.patch Obsoletes: gnome-mount <= 0.8 @@ -137,6 +141,10 @@ and iPod Touches to applications using gvfs. %patch1 -p1 -b .afc-unreleased %patch2 -p1 -b .metadata-rotated %patch3 -p1 -b .metadata-dir-fsync +%patch4 -p1 -b .smb-queryfs-older +%patch5 -p1 -b .metadata-gssize +%patch6 -p1 -b .metadata-mtime +%patch7 -p1 -b .fuse-timestamps %build @@ -302,6 +310,11 @@ killall -USR1 gvfsd >&/dev/null || : %{_datadir}/gvfs/remote-volume-monitors/afc.monitor %changelog +* Mon Nov 30 2009 Tomas Bzatek - 1.5.1-2 +- Metadata fixes +- SMB: Fix free space calculation for older samba servers +- fuse: Fix setting timestamps + * Wed Nov 18 2009 Tomas Bzatek - 1.5.1-1 - Update to 1.5.1 - AFC: temporarily disable setting file modification times