After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720062 - Implement seek and truncate on output stream for webdav
Implement seek and truncate on output stream for webdav
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: webdav backend
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2013-12-08 14:49 UTC by Ross Lagerwall
Modified: 2014-01-12 09:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
dav: Implement seek for output streams (2.46 KB, patch)
2013-12-08 20:46 UTC, Ross Lagerwall
reviewed Details | Review
dav: Implement truncate for output streams (2.30 KB, patch)
2013-12-08 20:47 UTC, Ross Lagerwall
reviewed Details | Review
dav: Implement seek for output streams (2.62 KB, patch)
2014-01-10 13:59 UTC, Ross Lagerwall
committed Details | Review
dav: Implement truncate for output streams (2.64 KB, patch)
2014-01-10 13:59 UTC, Ross Lagerwall
committed Details | Review

Description Ross Lagerwall 2013-12-08 14:49:23 UTC
This shouldn't be hard since for webdav, the output stream is a wrapper around GMemoryOutputStream.
Comment 1 Ross Lagerwall 2013-12-08 20:46:57 UTC
Created attachment 263776 [details] [review]
dav: Implement seek for output streams
Comment 2 Ross Lagerwall 2013-12-08 20:47:03 UTC
Created attachment 263777 [details] [review]
dav: Implement truncate for output streams
Comment 3 Ross Lagerwall 2013-12-08 20:48:12 UTC
Note that truncating larger streams fails without the glib patch in bug 720080.
Comment 4 Ross Lagerwall 2014-01-10 05:17:51 UTC
(In reply to comment #3)
> Note that truncating larger streams fails without the glib patch in bug 720080.

This has now been fixed.
Comment 5 Ondrej Holy 2014-01-10 13:12:09 UTC
Review of attachment 263776 [details] [review]:

::: daemon/gvfsbackenddav.c
@@ +2318,2 @@
   g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream);
+  g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE);

Wouldn't be better to use g_seekable_can_seek (G_SEEKABLE (stream)) there?

@@ +2361,2 @@
   g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream);
+  g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE);

dtto
Comment 6 Ondrej Holy 2014-01-10 13:14:44 UTC
Review of attachment 263777 [details] [review]:

::: daemon/gvfsbackenddav.c
@@ +2318,3 @@
   g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream);
   g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE);
+  g_vfs_job_open_for_write_set_can_truncate (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE);

dtto

@@ +2362,3 @@
   g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream);
   g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE);
+  g_vfs_job_open_for_write_set_can_truncate (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE);

dtto

@@ +2521,3 @@
+
+  if (g_seekable_truncate (stream, size, G_VFS_JOB (job)->cancellable, &error))
+    g_vfs_job_succeeded (G_VFS_JOB (job));

Please use brackets when the else section exists...
Comment 7 Ross Lagerwall 2014-01-10 13:59:08 UTC
Created attachment 265919 [details] [review]
dav: Implement seek for output streams
Comment 8 Ross Lagerwall 2014-01-10 13:59:14 UTC
Created attachment 265920 [details] [review]
dav: Implement truncate for output streams
Comment 9 Ross Lagerwall 2014-01-10 14:00:35 UTC
Thanks for the review. The updated patches should address the comments.
Comment 10 Ondrej Holy 2014-01-10 15:06:29 UTC
Review of attachment 265919 [details] [review]:

Looks good, thanks!
Comment 11 Ross Lagerwall 2014-01-12 09:06:41 UTC
Pushed to master as 686776f1a6f932e7751069715d9693e00f672b5c. Thanks!