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 604762 - Default port numbers are removed from bookmark destinations
Default port numbers are removed from bookmark destinations
Status: RESOLVED OBSOLETE
Product: gvfs
Classification: Core
Component: general
1.32.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2009-12-16 18:59 UTC by Sense Hofstede
Modified: 2018-09-21 16:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sftp: Always use port 22 if not specified (2.18 KB, patch)
2017-09-05 16:43 UTC, Ondrej Holy
reviewed Details | Review

Description Sense Hofstede 2009-12-16 18:59:56 UTC
When e.g. creating a bookmark with the destination sftp://user@server:22/folder Nautilus will remove the port number. It only does it when the port number is considered default.
However, it still does so when a different port number has been set as default, e.g. by changing the value in /etc/ssh/ssh_config concerning the default port number.

The consequence of this behaviour is that bookmarks to locations using default port numbers don't work on systems using custom port numbers.

This bug was originally reported by sjcire on Launchpad in Ubuntu at <https://launchpad.net/bugs/343000>.
Comment 1 Mike 2011-08-26 23:27:09 UTC
I can confirm this bug, and it has been confirmed in the launchpad bug mentioned above.

I hope this gets fixed pretty soon, but for now, this status can be changed to confirmed here.
Comment 2 António Fernandes 2017-09-04 11:32:41 UTC
This is still reproducible, despite the redesign of connect to server UI.

The default port number is dropped from the path shown in the Location entry and saved in the "Recent Servers" list.

This looks like a gvfs bug or feature. In gvfs/client/gdaemonvfs.c there is a condition that, as far a I understand, check if the provided port is different from default_port. Maybe that's what causes this?

Tentatively reassigning to gvfs.
Comment 3 Ondrej Holy 2017-09-05 11:15:17 UTC
Yes, this is caused by GVfs. GVfs tries to simplify the uris as much as possible in order to avoid duplicated mounts e.g. with/without default port. It does not expect that default port can be changed...

As far as I can tell, "ssh" doesn't provide any API to obtain the default port setting and sshd_config is not usually readable by a regular user, so GVfs can't react on it.

So, this feature has to be probably disabled for sftp backend probably, or the default port has to be always used internally at least...

You can change the DefaultPort entry in the following file to match your configuration as a workaround:
/usr/share/gvfs/mounts/sftp.mount
Comment 4 Ondrej Holy 2017-09-05 16:43:10 UTC
Created attachment 359214 [details] [review]
sftp: Always use port 22 if not specified

Currently, the default port - specified in mount file - is removed from
uri on client side, but it is not used by backend explicitely. It is not
a problem until the default port is changed in sshd_config and somebody
wants to connect to the server using the default port from mount file.
Let's use the port 22 explicitely, similarly as other backends do (i.e.
ftp, afc, afp).
Comment 5 Ondrej Holy 2017-09-05 16:44:11 UTC
It would be nice to obtain the default port from the mount file somehow in the backend, or handle this by mount tracker, but let's use this solution for beginning (it is used by other backends anyway)...
Comment 6 Ondrej Holy 2017-09-05 16:44:30 UTC
Can you please test the attached patch?
Comment 7 António Fernandes 2017-10-07 16:17:37 UTC
I can't test, sorry.

My comment 2 was misleading. When I said this was reproducible, I meant gvfs droping port 22 from URI. I'm not able to actually test this with a non-22 default port.
Comment 8 Ondrej Holy 2017-10-13 12:26:14 UTC
Review of attachment 359214 [details] [review]:

This fix has one unwanted effect. If you don't specify the port and non-standard port is used, than e.g. sftp://localhost/ will not work, but works correctly currently...

I am thinking about removal of that code from gdaemonvfs, so sftp://localhost/ would mean to use default port defined in sshd_config and not 22...

I've just realized that this bug applies also on ftp backend...
Comment 9 GNOME Infrastructure Team 2018-09-21 16:59:53 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/129.