Bug 322394 - SFTP URLs do not follow specification
SFTP URLs do not follow specification
Status: NEW
Product: gnome-vfs
Classification: Deprecated
Component: Module: ssh/sftp
2.15.x
Other All
: Normal normal
: ---
Assigned To: Christian Neumair
gnome-vfs maintainers
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-11-25 03:42 UTC by James Henstridge
Modified: 2007-06-28 20:55 UTC (History)
2 users (show)

See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Proposed first shot (5.51 KB, patch)
2006-08-12 12:54 UTC, Christian Neumair
none Details | Diff | Review

Description James Henstridge 2005-11-25 03:42:55 UTC
Please describe the problem:
SFTP URLs are not interpreted according to the published specification.

Steps to reproduce:
1. run "gnomevfs-ls sftp://remotehost/"


Actual results:
A directory listing is given for the root directory on remotehost

Expected results:
A directory listing is given for the user's home directory on remotehost

Does this happen every time?
yes

Other information:
The specification for sftp:// URIs is here:
  http://www.ietf.org/internet-drafts/draft-ietf-secsh-scp-sftp-ssh-uri-03.txt

It says that "sftp://remotehost/" would be interpreted as the directory ""
relative to the user's home directory, while "sftp://remotehost/%2F" is the root
directory on remotehost.
Comment 1 Allison Lortie (desrt) (extended vacation) 2005-11-25 04:06:17 UTC
+1

It's a shame we can't address bug 148888 with something similar :/
Comment 2 Alexander Larsson 2005-11-30 12:35:22 UTC
ftp has the same problem (according to the ftp uri rfc).
However, i'm not at all sure that this will work for gnome-vfs. Apps really
expect gnome-vfs uris to work in a specific way, and this will break that.
Comment 3 James Henstridge 2005-11-30 14:42:47 UTC
It seems that the main issue is listing the contents of the top level path in
the URI (which is the home dir plus top level dirs with a slash prepended).  I
can think of two ways to handle this:

* give a directory listing of the sftp path "" (the home dir) followed by a
listing of "/", with the slash prepended to the results.

* give a listing of "", plus an extra "/" entry, and then let people list
sftp://hostname/%2F to get the toplevel directories.

Is there any other issues?
Comment 4 Christian Neumair 2005-11-30 18:55:09 UTC
> Is there any other issues?

The issue is that people who don't know the spec have no clue that they have to
enter ftp://%2ffoo/bar if they don't want their default home dir.
Comment 5 James Henstridge 2005-12-01 15:01:20 UTC
Christian: either of the two solutions I listed previously would allow
navigation to top level directories.
Comment 6 Christian Neumair 2006-08-12 12:54:49 UTC
Created attachment 70775 [details] [review]
Proposed first shot

Newer drafts of the URI spec [1] suggest to use a tilde, i.e. to expand sftp://host/~/ to an URI referring to the home directory. The attached patch implements this. Unfortunately, Nautilus can't deal with these very well because it resolves URIs using string manipulation and supposes / is the parent of /~/. I suggest its algorithms should check for a segment being "~" and returning the info for "some_path/~/..", or maybe this should be done at the GnomeVFS level?

[1] http://tools.ietf.org/wg/secsh/draft-ietf-secsh-scp-sftp-ssh-uri/draft-ietf-secsh-scp-sftp-ssh-uri-04.txt
Comment 7 Christian Neumair 2006-08-12 12:55:22 UTC
Updating version, assigning to myself.
Comment 8 Andrew Jorgensen 2007-06-28 20:32:33 UTC
This is something that's bothered me for a long time.  My old ISP provided shell access to some of their servers but the path to your home directory was long and complicated (they have thousands of customers) and if you didn't know it already there was no way to get to it using gnome-vfs.

I don't think I agree with the RFC in either it's older or new versions, though there are advantages to either.  If sftp://host//path/file meant an absolute path (%2F is /)  and sftp://host/path/file meant a home-relative path that would probably be an ideal solution. It's unfortunate that this would break some applications, or at least some assumptions.

A good temporary solution to my own problem (not being able to find $HOME) would be to have gnome-vfs redirect from sftp://host to sftp://host/path/to/home like KDE's kio-stuff does.  Does gnome-vfs support redirects?  I have only skimmed the RFC but I don't see anything to suggest that such behavior would violate the specification.
Comment 9 Andrew Jorgensen 2007-06-28 20:55:50 UTC
Finished reading the RFC.  We can interpret paths however we want but it's recommended that the path be considered absolute and we may interpret /~ to refer to the home directory.  In this case I think it would still be of value to redirect from an empty path to /~.  It seems that this would not actually break anything since old applications would always use absolute paths and only new applications would take advantage of the /~ shortcut.

Note You need to log in before you can comment on or make changes to this bug.