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 519071 - Add write support to ObexFTP
Add write support to ObexFTP
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: [obsolete] obexftp backend
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
: 526728 565490 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-02-27 15:19 UTC by Bastien Nocera
Modified: 2009-01-28 12:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
first attempt (9.93 KB, patch)
2009-01-23 16:36 UTC, Cosimo Cecchi
none Details | Review
patch v2 (13.42 KB, patch)
2009-01-26 02:02 UTC, Cosimo Cecchi
needs-work Details | Review
patch v3 (13.73 KB, patch)
2009-01-26 16:31 UTC, Cosimo Cecchi
committed Details | Review

Description Bastien Nocera 2008-02-27 15:19:38 UTC
The obex-data-server can only upload local files, so we'd need to cache the files locally and then upload them (which completely breaks progress).

A better way might be to:
- when opening for write, create a fifo with a large buffer
- pass that file onto obex-data-server, and make it sleep a bit on EAGAIN errors instead of bailing out straight away (this would need to be done in openobex' OBEX_Request, and only if it's a OBEX_CMD_PUT). It should also transform the EPIPE closing the transfer into a normal end of file.
Comment 1 A. Walton 2008-04-08 17:22:11 UTC
*** Bug 526728 has been marked as a duplicate of this bug. ***
Comment 2 Thomas van der Burgt 2008-08-24 18:14:22 UTC
This is still the case on ubuntu Intrepid Ibex (alpha). I would like to see this fixed, especially because it used to work before hardy (when the switch to gvfs was made)
Comment 3 John Cooper 2008-08-29 14:00:42 UTC
I have been using obexFs which has write support. Could bits of this not be included in the Gvfs module?

http://dev.zuckschwerdt.org/openobex/wiki/ObexFs
Comment 4 Viktor Kojouharov 2008-11-08 19:31:23 UTC
Better yet, why can't the write operations be copied from gnome-vfs-obex? Write support worked very well back then.
Comment 5 Thomas Perl 2008-11-19 19:16:34 UTC
I would also like to have this fixed, so I don't have to interface with obexftp directly but can simply write my code against gvfs.
Comment 6 Bastien Nocera 2008-12-25 14:55:37 UTC
*** Bug 565490 has been marked as a duplicate of this bug. ***
Comment 7 Cosimo Cecchi 2009-01-23 16:36:51 UTC
Created attachment 127106 [details] [review]
first attempt

First working patch. Works fine for files, but not for directories...I guess that's not easy, as we have no way of knowing when the directory has actually been created to cd inside it. Any opinions?
Comment 8 Bastien Nocera 2009-01-23 17:16:18 UTC
(In reply to comment #7)
> Created an attachment (id=127106) [edit]
> first attempt
> 
> First working patch. Works fine for files, but not for directories...I guess
> that's not easy, as we have no way of knowing when the directory has actually
> been created to cd inside it. Any opinions?
> 

Is do_push supposed to be used for directories? We already know how to create directories, but the lack of feedback from obex-data-server is a bit of a problem.

Would you mind filing a bug upstream about that?
Comment 9 Cosimo Cecchi 2009-01-24 01:41:31 UTC
Upstream bug is http://bugs.muiline.com/view.php?id=152
Comment 10 Cosimo Cecchi 2009-01-26 02:02:13 UTC
Created attachment 127227 [details] [review]
patch v2

Actually upstream bug doesn't really matters, as I found out the directory creation is sync. What wasn't working wrt. directories is we forgot to invalidate the query_info cache after _make_directory (), so we would get errors when we tried to lookup in the cache the newly added directory.

Attached patch adds error handling and works great in my testing with trees of files and directories.
Comment 11 Bastien Nocera 2009-01-26 11:36:14 UTC
Patch looks good. Could you add a helper function to reset the directory listing cache though, and also make sure that a decent error happens when copying from non-local sources (such as smb or sftp sources)?
Comment 12 Cosimo Cecchi 2009-01-26 16:31:10 UTC
Created attachment 127268 [details] [review]
patch v3

Factorized _invalidate_cache_helper ().
When we copy from a remote location, we get "operation not supported by backend" in Nautilus, does this seems reasonable? Otherwise I can implement a fake "do_open_for_write" with a more meaningful error like "Copying files from a remote location is not supported".
Comment 13 Bastien Nocera 2009-01-28 12:13:38 UTC
(In reply to comment #12)
> Created an attachment (id=127268) [edit]
> patch v3
> 
> Factorized _invalidate_cache_helper ().
> When we copy from a remote location, we get "operation not supported by
> backend" in Nautilus, does this seems reasonable? Otherwise I can implement a
> fake "do_open_for_write" with a more meaningful error like "Copying files from
> a remote location is not supported".

Don't think that'll be needed for now.
Comment 14 Cosimo Cecchi 2009-01-28 12:52:58 UTC
Thanks for the review, committed to trunk.

2009-01-28  Cosimo Cecchi  <cosimoc@gnome.org>

	* daemon/gvfsbackendobexftp.c: (_invalidate_cache_helper),
	(do_mount), (push_transfer_started_cb),
	(push_transfer_completed_cb), (push_transfer_progress_cb),
	(push_data_free), (_push_single_file_helper), (do_push),
	(do_make_directory), (g_vfs_backend_obexftp_class_init):
	* daemon/obexftp-marshal.list:
	Implement write support for the ObexFTP backend (#519071).