[Dapper] Gedit fails to save to remote location if creating new file while using sftp

Bug #39024 reported by ian marcinkowski
14
Affects Status Importance Assigned to Milestone
gedit (Ubuntu)
Invalid
Medium
Ubuntu Desktop Bugs
gnome-vfs2 (Ubuntu)
Fix Released
Medium
Ubuntu Desktop Bugs

Bug Description

When saving a new remote file over sftp, gedit gives the following error:

Could not save the file sftp://path/to/remote.file
Unexpected error: Protocol Error

This initial save operation creates the file on the remote system but doesn't save any data to the file.

All subsequent operations function as they should.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for your bug. Do you still have the issue? That works fine for me doing that:
- opening gedit
- typing some text
- clicking on save
- browse a sftp share from the places list to a directory with writting permissions for the user

Changed in gedit:
assignee: nobody → desktop-bugs
status: Unconfirmed → Needs Info
Revision history for this message
ian marcinkowski (ianmarcinkowski) wrote :

I'm still experiencing this problem.

I've got full permissions on the folders I'm trying to write to.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Do you still have that issue? How do you edit your text? Do you open an existing one from nautilus? or do you create one and save it? what ssh server do you use? does gnomevfs-copy txt sftp:.... works fine from the command line?

Revision history for this message
Allison Karlitskaya (desrt) wrote :

The "protocol error" happens, not on first save, but rather, if the file does not yet exist on the remote host.

You can get it to happen by opening a file in gedit, erasing the file on the remote host (logged in, using 'rm') then clicking 'save'.

When I do this, however, I don't get an empty file -- the file is actually saved correctly.

Revision history for this message
ian marcinkowski (ianmarcinkowski) wrote :

I still have the problem. When I experience this problem, I'm creating a new document in gedit, then saving to the sftp server. I guess I'm using the standard ssh server, though I don't really know how to check.

I edit existing remote files by opening them from nautilus.

gnomevfs-copy seems to be the source of the problem. When I copy a local file into a not-yet-created file on the remote server, I get a protocol error.
computer:~/Desktop$ gnomevfs-copy foo sftp://server/home/person/foo
Failed to copy foo to sftp://server/home/person/foo
Reason: Protocol error

Revision history for this message
Allison Karlitskaya (desrt) wrote :

The problem is caused by iobuf_read_file_info() in the gnome-vfs sftp method.

        if (id != expected_id || type != SSH2_FXP_ATTRS) {
                buffer_free (&msg);
                return GNOME_VFS_ERROR_PROTOCOL_ERROR;
        }
        else if (type == SSH2_FXP_STATUS) {
                gnome_vfs_file_info_clear (info);
                status = buffer_read_gint32 (&msg);
                buffer_free (&msg);
                return sftp_status_to_vfs_result (status);
        }

Notice that it's actually impossible for the (type == SSH2_FXP_STATUS) to ever be true and that in this case the PROTOCOL_ERROR is incorrectly returned.

I've written a patch to move the order of the code around to the logical order. The patch fixes the problem.

Changed in gedit:
status: Needs Info → Rejected
Changed in gnome-vfs2:
status: Unconfirmed → In Progress
Revision history for this message
Allison Karlitskaya (desrt) wrote : debdiff fixes the problem.

boop.

Revision history for this message
Allison Karlitskaya (desrt) wrote : new version

-0ubuntu8

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for the patch Ryan. Did you forward that upstream?

This upload fixes the issue:

 gnome-vfs2 (2.14.1-0ubuntu8) dapper; urgency=low
 .
   [ Ryan Lortie ]
   * debian/patches/10_sftp_status_fix.patch
     - fix "Protocol Error" due to incorrect error checking (Ubuntu: #39024)

Changed in gnome-vfs2:
assignee: nobody → desktop-bugs
status: In Progress → Fix Released
Revision history for this message
Allison Karlitskaya (desrt) wrote :

It looks like upstream has rewritten a bunch of that code. Near as I can tell their rewrite addresses the issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.