Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 499198

Summary: sys-apps/portage-2.2.7: PORTAGE_BINHOST="sftp://..." is using port 22 instead of port from /etc/ssh/ssh_config
Product: Portage Development Reporter: Nikoli <nikoli>
Component: .tbz2 supportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 573774    

Description Nikoli 2014-01-25 08:00:55 UTC
If port is not set in PORTAGE_BINHOST="sftp://...", emerge will use port 22, please change it to respect /etc/ssh/ssh_config and not force port 22 by default.
Comment 1 Oleh 2016-05-04 15:49:46 UTC
i can reproduce this.
1. When ssh:// used for binhost, and PORTAGE_SSH_OPTS set to "-p ${portnumber}"
it works.

2. When sftp:// used for binhost, and PORTAGE_SSH_OPTS set to "-P $portnumber}"

it still trying to use port 22 instead.

oleg oleg # emerge -gav htop
ssh: connect to host ....org port 22: Connection refused
Couldn't read packet: Connection reset by peer
Fetcher exited with a failure condition.


!!! Error fetching binhost package info from 'sftp://.../var/src/packages'
!!! FETCHCOMMAND_SFTP failed
Comment 2 Oleh 2016-05-05 14:27:39 UTC
here is details which may enlighten things:
https://bugs.funtoo.org/browse/FL-3200
apparently FETCHCOMMAND_SFTP have port hardcode to 22, which is always used as first argument for sftp, which makes it ignore any other custom defined ports.
Comment 3 Zac Medico gentoo-dev 2016-05-05 17:16:23 UTC
(In reply to Nikoli from comment #0)
> If port is not set in PORTAGE_BINHOST="sftp://...", emerge will use port 22,
> please change it to respect /etc/ssh/ssh_config and not force port 22 by
> default.

If you specify PORTAGE_BINHOST="sftp://host:port/..." then it will respect the port that you have defined in PORTAGE_BINHOST.

I have a patch to make it respect ssh_config in the following branch:

https://github.com/zmedico/portage/tree/bug_499198
Comment 4 Oleh 2016-05-06 03:01:18 UTC
this patch fixes. ports now respected, when set in PORTAGE_SSH_OPTS. in ssh and sftp.
Comment 5 Zac Medico gentoo-dev 2016-05-07 20:13:14 UTC
(In reply to Oleg from comment #4)
> this patch fixes. ports now respected, when set in PORTAGE_SSH_OPTS. in ssh
> and sftp.

Great, thanks for testing.

This is in the master branch:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=a810a92d615c904db59326188e1437fdab74e705
Comment 6 Zac Medico gentoo-dev 2017-08-11 21:15:02 UTC
Fixed in 2.3.0.