* [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198)
@ 2016-05-05 17:13 Zac Medico
2016-05-06 13:11 ` Alexander Berntsen
2016-05-06 16:44 ` Zac Medico
0 siblings, 2 replies; 5+ messages in thread
From: Zac Medico @ 2016-05-05 17:13 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
X-Gentoo-bug: 499198
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=499198
---
cnf/make.globals | 4 ++--
pym/portage/tests/util/test_getconfig.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cnf/make.globals b/cnf/make.globals
index 836bb5c..18eba94 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -43,11 +43,11 @@ FETCHCOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
RESUMECOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
# NOTE: rsync will evaluate quotes embedded inside PORTAGE_SSH_OPTS
-FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
+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}\""
RESUMECOMMAND_SSH=${FETCHCOMMAND_SSH}
# NOTE: bash eval is used to evaluate quotes embedded inside PORTAGE_SSH_OPTS
-FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; eval \\\"declare -a ssh_opts=(\\\${3})\\\" ; exec sftp -P \\\${port} \\\"\\\${ssh_opts[@]}\\\" \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
+FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; eval \\\"declare -a ssh_opts=(\\\${3})\\\" ; exec sftp \\\${port:+-P \\\${port}} \\\"\\\${ssh_opts[@]}\\\" \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
# Default user options
FEATURES="assume-digests binpkg-logs
diff --git a/pym/portage/tests/util/test_getconfig.py b/pym/portage/tests/util/test_getconfig.py
index b72bd6a..05e3147 100644
--- a/pym/portage/tests/util/test_getconfig.py
+++ b/pym/portage/tests/util/test_getconfig.py
@@ -20,8 +20,8 @@ class GetConfigTestCase(TestCase):
_cases = {
'FETCHCOMMAND' : 'wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}"',
'FETCHCOMMAND_RSYNC' : 'rsync -avP "${URI}" "${DISTDIR}/${FILE}"',
- 'FETCHCOMMAND_SFTP' : 'bash -c "x=\\${2#sftp://} ; host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = \\${port} ]] && port=22 ; eval \\"declare -a ssh_opts=(\\${3})\\" ; exec sftp -P \\${port} \\"\\${ssh_opts[@]}\\" \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
- 'FETCHCOMMAND_SSH' : 'bash -c "x=\\${2#ssh://} ; host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = \\${port} ]] && port=22 ; exec rsync --rsh=\\"ssh -p\\${port} \\${3}\\" -avP \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
+ 'FETCHCOMMAND_SFTP' : 'bash -c "x=\\${2#sftp://} ; host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = \\${port} ]] && port= ; eval \\"declare -a ssh_opts=(\\${3})\\" ; exec sftp \\${port:+-P \\${port}} \\"\\${ssh_opts[@]}\\" \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
+ '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}"',
'PORTAGE_ELOG_MAILSUBJECT' : '[portage] ebuild log for ${PACKAGE} on ${HOST}'
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198)
2016-05-05 17:13 [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198) Zac Medico
@ 2016-05-06 13:11 ` Alexander Berntsen
2016-05-06 16:44 ` Zac Medico
1 sibling, 0 replies; 5+ messages in thread
From: Alexander Berntsen @ 2016-05-06 13:11 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Ooph. --word-diff pls.
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJXLJfnAAoJENQqWdRUGk8BfqcP/2W4/PXsI5+NaNN0+q4Gn6M3
ThiDKKlx5AanDNJwIkyeXrq+7IBbMwrPNfQ4yPY84W9nBLHcJjQxyaYPtHZmgUvI
TGx8TL0bxYDmG4/u3527Dna7mAqD9e9xGmzlO3qt53WI9mNt4yppzWKYA4oTJUOf
2sMUjV7zLSp4RtVt7ATyjE3dbE1rh/pJLsrMv6KtaqEX3BQRwsLiAnjd2/kvZ4f5
8uUJJxPdCB78eTjVJ3M/FlI3nV+gt4WlsFuEVM5DaW08vF7MGHrDLe/FSTgjIRjf
EUZtMX4TukfiW3+M+tm9hLCSEkN+0uIYHDml+T54rW+cCOGWXn6O9RzKuIC+2vln
hwknnRP8ZMAEedBpPDbqrUeN5VFTVPU+nms3+fHXfA3HdB6tZQGhnOfJ+qO5KBcv
++jmS+D9nCvGhAc890zEuDRaNMYGQ5wC53bGlFPwXHO9cGrbps9s+xTRzDRCm8Yx
o5Fa3QpoOutEJX07DVnZyhfZVieDdP5/vWw0Vi2K1NU1U218/Qxfl+guU6G6BFf6
9Ut71v6A/Fo6B9Ikp6TuPLoOVIA42RXpa3D+HmnHu8FiIeAwX7gdO6hpUjMlekIh
g7GD3w1nn4h8KM9sZn/inkuZsvoq4ux0tE0pbELN632CrLjQvbau/VgbT2ehVx4q
qfZaui1LkdG25RGa0ZR1
=nEZ6
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198)
2016-05-05 17:13 [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198) Zac Medico
2016-05-06 13:11 ` Alexander Berntsen
@ 2016-05-06 16:44 ` Zac Medico
2016-05-07 11:38 ` Alexander Berntsen
1 sibling, 1 reply; 5+ messages in thread
From: Zac Medico @ 2016-05-06 16:44 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
X-Gentoo-bug: 499198
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=499198
---
This is the same as the previous patch, but formatted with --word-diff.
cnf/make.globals | 4 ++--
pym/portage/tests/util/test_getconfig.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cnf/make.globals b/cnf/make.globals
index 836bb5c..18eba94 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -43,11 +43,11 @@ FETCHCOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
RESUMECOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
# NOTE: rsync will evaluate quotes embedded inside PORTAGE_SSH_OPTS
FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && [-port=22-]{+port=+} ; exec rsync --rsh=\\\"ssh [--p\\\${port}-]{+\\\${port:+-p\\\${port}}+} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
RESUMECOMMAND_SSH=${FETCHCOMMAND_SSH}
# NOTE: bash eval is used to evaluate quotes embedded inside PORTAGE_SSH_OPTS
FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && [-port=22-]{+port=+} ; eval \\\"declare -a ssh_opts=(\\\${3})\\\" ; exec sftp [--P \\\${port}-]{+\\\${port:+-P \\\${port}}+} \\\"\\\${ssh_opts[@]}\\\" \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
# Default user options
FEATURES="assume-digests binpkg-logs
diff --git a/pym/portage/tests/util/test_getconfig.py b/pym/portage/tests/util/test_getconfig.py
index b72bd6a..05e3147 100644
--- a/pym/portage/tests/util/test_getconfig.py
+++ b/pym/portage/tests/util/test_getconfig.py
@@ -20,8 +20,8 @@ class GetConfigTestCase(TestCase):
_cases = {
'FETCHCOMMAND' : 'wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}"',
'FETCHCOMMAND_RSYNC' : 'rsync -avP "${URI}" "${DISTDIR}/${FILE}"',
'FETCHCOMMAND_SFTP' : 'bash -c "x=\\${2#sftp://} ; host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = \\${port} ]] && [-port=22-]{+port=+} ; eval \\"declare -a ssh_opts=(\\${3})\\" ; exec sftp [--P \\${port}-]{+\\${port:+-P \\${port}}+} \\"\\${ssh_opts[@]}\\" \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
'FETCHCOMMAND_SSH' : 'bash -c "x=\\${2#ssh://} ; host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = \\${port} ]] && [-port=22-]{+port=+} ; exec rsync --rsh=\\"ssh [--p\\${port}-]{+\\${port:+-p\\${port}}+} \\${3}\\" -avP \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
'PORTAGE_ELOG_MAILSUBJECT' : '[portage] ebuild log for ${PACKAGE} on ${HOST}'
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198)
2016-05-06 16:44 ` Zac Medico
@ 2016-05-07 11:38 ` Alexander Berntsen
2016-05-07 20:26 ` Zac Medico
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Berntsen @ 2016-05-07 11:38 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Still barely readable without putting it in git and getting colours.
Which tells me this should probably not look the way it looks at
present...
But it looks like it's doing what it's supposed to be doing. So go
ahead and push.
I think the message title is about a billion characters above budget,
so perhaps just make it "make.globals: Respect ssh_config port (bug
499198)" or something; your call though.
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJXLdO7AAoJENQqWdRUGk8BIiEP/jg4VUH9z9i4f1L4tzoQhPw6
SotIsBFg9QGFsgL/+geRKuDv7BTGqO3DhX2IxrqhyhTKScGBcLPoGLvGNvE0xm8a
fWQ8Nf3seIwamtXr7+adggqzrjh8/PSa2n8aloc++n0dGqkMVpzubMOLsAdIFFN+
DwT60ExUGFSIdHqzYWnGXHaFkiAOrfZ8lLoXjTUf49lNzL5OxWYVqD+L3vKeStiT
qCRk8y6m9MX2lW7XQjRRc5LS0KdWWcJTRJ8qYcdFIQkZ4OQo3P1Us+hvLQjWfpvK
BR7GXiVBtGalhElTE4lCNklvP54lWIic306G/3BxiqubKWsRV3seq0UjCgWkHmjq
7Hp27rlTTcK5adKm22a9S16BUcbtaigcKm78FSwcD9WsvLDEETDt5iup4QknN1Wy
si04s4dklfCaCbHMP/4fHNfobVGMQwi5vv5RMNNydhRDFjMxnKUvtxawSLylA0hY
+fe4KQdswwR3cbWqK++Pi1hDmsdOKGvqgoFLlruNvydDrdDBRFBV5HMWBO0oBsPx
PGDQESM2cVQV5b2ZF+5vepptxEvgkPWkguBb7N+alQgh/47Umhh0qj/bEnTp/j5t
DR5hqXsm69jwFRm+mE9aY4ly3Nr876+y8T/u6jWvdwecsPKioqH1gbRfkJfQ1Ze5
7Z4FeJF7IfpR4uw2rYr2
=3mxh
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198)
2016-05-07 11:38 ` Alexander Berntsen
@ 2016-05-07 20:26 ` Zac Medico
0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2016-05-07 20:26 UTC (permalink / raw
To: gentoo-portage-dev
On 05/07/2016 04:38 AM, Alexander Berntsen wrote:
> Still barely readable without putting it in git and getting colours.
> Which tells me this should probably not look the way it looks at
> present...
Yeah, we could certainly split the code out into standalone shell
scripts and install them in sub-directory of $PORTAGE_BIN_PATH.
The code makes a good test case for make.* parsing with respect to
quoting and multiple layers of escapes, so maybe we should keep
something similar in the unit tests.
The code was sort of a quick and dirty fix that was never really
intended to be readable, which may have contributed to the 2+ years that
went by before someone got around to writing a patch.
> But it looks like it's doing what it's supposed to be doing. So go
> ahead and push.
>
> I think the message title is about a billion characters above budget,
> so perhaps just make it "make.globals: Respect ssh_config port (bug
> 499198)" or something; your call though.
Thanks, I've pushed it with your shorter commit message.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-07 20:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-05 17:13 [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198) Zac Medico
2016-05-06 13:11 ` Alexander Berntsen
2016-05-06 16:44 ` Zac Medico
2016-05-07 11:38 ` Alexander Berntsen
2016-05-07 20:26 ` Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox