When an IPV6 address is defined for this parameter, either the ':'s are misinterpreted, or [] is passed to ssh. I believe that the [] could just be stripped passing it to ssh. USE="minimal" emerge -1 libsndfile -a -g ssh: Could not resolve hostname [xx:yy:ab74]: Name or service not known Traceback (most recent call last): File "/usr/lib/python-exec/python3.11/emerge", line 57, in main retval = emerge_main() ^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/_emerge/main.py", line 1308, in emerge_main return run_action(emerge_config) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/_emerge/actions.py", line 3479, in run_action mytrees["bintree"].populate( File "/usr/lib/python3.11/site-packages/portage/dbapi/bintree.py", line 920, in populate self._populate_remote( File "/usr/lib/python3.11/site-packages/portage/dbapi/bintree.py", line 1334, in _populate_remote port = parsed_url.port ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/urllib/parse.py", line 182, in port raise ValueError(f"Port could not be cast to integer value as {port!r}") ValueError: Port could not be cast to integer value as 'xx:yy:ab74'
Sharing the binrepos.confg would be useful for validating it. I see why "ssh: Could not resolve hostname [xx:yy:ab74]: Name or service not known" happens but not where "ValueError: Port could not be cast to integer value as 'xx:yy:ab74'" comes from, especially when urllib doesn't recognize "[xx:yy:ab74]" as a valid address. But I do see the same behaviour with brackets getting given to ssh. This would addressed by using .hostname instead .netloc with urllib, especially when the port is added in afterwards so this wouldn't change behaviour much.
(In reply to Alfred Wingate from comment #1) > Sharing the binrepos.confg would be useful for validating it. I see why > "ssh: Could not resolve hostname [xx:yy:ab74]: Name or service not known" > happens but not where "ValueError: Port could not be cast to integer value > as 'xx:yy:ab74'" comes from, especially when urllib doesn't recognize > "[xx:yy:ab74]" as a valid address. > > But I do see the same behaviour with brackets getting given to ssh. This > would addressed by using .hostname instead .netloc with urllib, especially > when the port is added in afterwards so this wouldn't change behaviour much. No "binrepos" set, I'm using: PORTAGE_BINHOST="ssh://[xx:yy:ab74]/var/cache/binpkgs"
>>> from urllib.parse import urlparse >>> urlparse("ssh://[xx:yy:ab74]/var/cache/binpkgs") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.11/urllib/parse.py", line 395, in urlparse splitresult = urlsplit(url, scheme, allow_fragments) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/urllib/parse.py", line 500, in urlsplit _check_bracketed_host(bracketed_host) File "/usr/lib/python3.11/urllib/parse.py", line 446, in _check_bracketed_host ip = ipaddress.ip_address(hostname) # Throws Value Error if not IPv6 or IPv4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/ipaddress.py", line 54, in ip_address raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address') ValueError: 'xx:yy:ab74' does not appear to be an IPv4 or IPv6 address Are you use this is a valid address? Or are you censoring your ip?
(In reply to Alfred Wingate from comment #3) > >>> from urllib.parse import urlparse > >>> urlparse("ssh://[xx:yy:ab74]/var/cache/binpkgs") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/usr/lib/python3.11/urllib/parse.py", line 395, in urlparse > splitresult = urlsplit(url, scheme, allow_fragments) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib/python3.11/urllib/parse.py", line 500, in urlsplit > _check_bracketed_host(bracketed_host) > File "/usr/lib/python3.11/urllib/parse.py", line 446, in > _check_bracketed_host > ip = ipaddress.ip_address(hostname) # Throws Value Error if not IPv6 or > IPv4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib/python3.11/ipaddress.py", line 54, in ip_address > raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 > address') > ValueError: 'xx:yy:ab74' does not appear to be an IPv4 or IPv6 address > > Are you use this is a valid address? Or are you censoring your ip? Censoring because it's a public IP. It's valid and I've tested SSHing to it.
May also need to adjust FETCHCOMMAND_SSH, since it also parses host and port: FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=58b094bc79e999e44a5b108e2b7273c164aa906e commit 58b094bc79e999e44a5b108e2b7273c164aa906e Author: Alfred Wingate <parona@protonmail.com> AuthorDate: 2024-01-05 19:30:38 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-01-16 05:16:09 +0000 bintree: use urllib provided attributes for hostname, user and password In addition to simplifying it also solves an issue with parsing raw ipv6 addresses. Bug: https://bugs.gentoo.org/921400 Signed-off-by: Alfred Wingate <parona@protonmail.com> Closes: https://github.com/gentoo/portage/pull/1230 Signed-off-by: Sam James <sam@gentoo.org> lib/portage/dbapi/bintree.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77c44c46194922509bc4f2b5cfc099412a560a69 commit 77c44c46194922509bc4f2b5cfc099412a560a69 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-02-22 07:23:40 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-02-22 07:23:50 +0000 sys-apps/portage: add 3.0.62 Closes: https://bugs.gentoo.org/663324 Closes: https://bugs.gentoo.org/728046 Closes: https://bugs.gentoo.org/891137 Closes: https://bugs.gentoo.org/906368 Closes: https://bugs.gentoo.org/916566 Closes: https://bugs.gentoo.org/921170 Closes: https://bugs.gentoo.org/921208 Closes: https://bugs.gentoo.org/921400 Closes: https://bugs.gentoo.org/922038 Closes: https://bugs.gentoo.org/922142 Closes: https://bugs.gentoo.org/923368 Closes: https://bugs.gentoo.org/923750 Closes: https://bugs.gentoo.org/923841 Closes: https://bugs.gentoo.org/923852 Closes: https://bugs.gentoo.org/923854 Closes: https://bugs.gentoo.org/924192 Closes: https://bugs.gentoo.org/924273 Closes: https://bugs.gentoo.org/924585 Closes: https://bugs.gentoo.org/921380 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.62.ebuild | 246 +++++++++++++++++++++++++++++++++ 2 files changed, 247 insertions(+)