[02/11] support/download: fix scp download with scheme prefix 'scp://'

Message ID 20190103204026.23512-3-patrickdepinguin@gmail.com
State New
Headers show
Series
  • support/download: fix scp and reintroduce source-check
Related show

Commit Message

Thomas De Schampheleire Jan. 3, 2019, 8:40 p.m.
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

The scp download helper is broken when the server URL starts with 'scp://'.
Such prefix is used in two situations:
1. to let FOO_SITE point to an scp location without explicitly having to set
   'FOO_SITE_METHOD = scp'

2. when BR2_PRIMARY_SITE or BR2_BACKUP_SITE points to an scp location. In
   this case, there is no equivalent of 'SITE_METHOD'.

Strip out the scheme prefix, similarly to how the 'file' download helper
does it. That helper has the same cases as above.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 support/download/scp | 3 +++
 1 file changed, 3 insertions(+)

Comments

Yann E. MORIN Jan. 3, 2019, 9:32 p.m. | #1
Thomas, All,

On 2019-01-03 21:40 +0100, Thomas De Schampheleire spake thusly:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> 
> The scp download helper is broken when the server URL starts with 'scp://'.
> Such prefix is used in two situations:
> 1. to let FOO_SITE point to an scp location without explicitly having to set
>    'FOO_SITE_METHOD = scp'
> 
> 2. when BR2_PRIMARY_SITE or BR2_BACKUP_SITE points to an scp location. In
>    this case, there is no equivalent of 'SITE_METHOD'.
> 
> Strip out the scheme prefix, similarly to how the 'file' download helper
> does it. That helper has the same cases as above.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> ---
>  support/download/scp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/support/download/scp b/support/download/scp
> index 746c3c6ba0..55f588e157 100755
> --- a/support/download/scp
> +++ b/support/download/scp
> @@ -34,4 +34,7 @@ _scp() {
>      eval ${SCP} "${@}"
>  }
>  
> +# Remove any scheme prefix
> +uri="${uri##scp://}"

I was pretty sure that we could pass sdcp:// to the scp tool. That's
funny how one can get very wrong about such simple things...

So it only proves that I don't use scp that often, indee.

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

>  _scp ${verbose} "${@}" "'${uri}/${filename}'" "'${output}'"
> -- 
> 2.18.1
>

Patch

diff --git a/support/download/scp b/support/download/scp
index 746c3c6ba0..55f588e157 100755
--- a/support/download/scp
+++ b/support/download/scp
@@ -34,4 +34,7 @@  _scp() {
     eval ${SCP} "${@}"
 }
 
+# Remove any scheme prefix
+uri="${uri##scp://}"
+
 _scp ${verbose} "${@}" "'${uri}/${filename}'" "'${output}'"