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 304022 - sftp-method confuse SSH2_FX and GNOME_VFS codes
sftp-method confuse SSH2_FX and GNOME_VFS codes
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Module: ssh/sftp
2.11.x
Other Linux
: High major
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
Depends on:
Blocks:
 
 
Reported: 2005-05-13 09:22 UTC by Olivier Sessink
Modified: 2005-07-18 08:19 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
fixes the issue (1.98 KB, patch)
2005-07-17 20:27 UTC, Sebastien Bacher
none Details | Review

Description Olivier Sessink 2005-05-13 09:22:01 UTC
Version details: 2.8.4
Distribution/Version: Debian Sid

I try to open a uri for writing, the problem is only visible in sftp:// uri's:

gnome_vfs_async_open_uri(&sf->handle,uri,GNOME_VFS_OPEN_WRITE,GNOME_VFS_PRIORITY_DEFAULT
				,savefile_asyncopenuri_lcb,sf);

the uri does not exist, so I expect a 'File not found', but instead of that, I
get a result=18 'End of file'

a workaround for my code could be to handle any 'End of file' error as 'File not
found' and create the uri, but still this should be fixed in the sftp module.

the problem is not visible for files that are on my local disk. I have not
tested any other remote filesystem, because I do not have access to any other
server then sftp
Comment 1 Sebastien Bacher 2005-07-17 14:58:13 UTC
Thanks for your bug

The issue is than do_open() uses this code:

"	sftp_res = iobuf_read_handle (conn->in_fd, &sftp_handle, id, (guint32
*)&sftp_handle_len);
...
	if (sftp_res == SSH2_FX_OK) {
...
	} else {
....
		return sftp_status_to_vfs_result (sftp_res);"

or 

"static GnomeVFSResult
iobuf_read_handle (int fd, gchar **handle, guint expected_id, guint32 *len)
...
		return sftp_status_to_vfs_result (status)"


so sftp_res is already a GnomeVFSResult and sftp_status_to_vfs_result () should
not be used


gnome-vfs maintainers, sftp-method.c has this error at different places. Should
the different iobuf_ functions return a "guint"? 
Comment 2 Sebastien Bacher 2005-07-17 20:27:18 UTC
Created attachment 49329 [details] [review]
fixes the issue

sftp_res is GnomeVFSResult, compare with GNOME_VFS_ symbols instead of SSH2_FX_
and don't use sftp_status_to_vfs_result on it
Comment 3 Alexander Larsson 2005-07-18 08:19:54 UTC
nice catch. I also removed the guint sftp_res and reused the GnomeVFSResult res
variables instead.