Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] support/download/file: fix file:// protocol handling
@ 2018-05-08 13:28 Angelo Compagnucci
  2018-05-08 13:34 ` Yann E. MORIN
  2018-05-13 20:26 ` Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Angelo Compagnucci @ 2018-05-08 13:28 UTC (permalink / raw)
  To: buildroot

When a file is used a source for download using the file:// protocol, a
malformed url is passed to the file download script which then crashes.
Following an example of a wrong path passed to the script:

eval cp -v ''\''file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2'\''' ''\''/home/angelo/DEV/BUILDROOT/br_qemu_arm/build/.armv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2.f403PT/output'\'''.

Path passed to cp lacks of a / between dir and file part of the url,
moreover it presents a wrong file:// prefix.

Fixes:

cp: cannot stat
'file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2':
No such file or directory

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 support/download/file | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/download/file b/support/download/file
index fefd6d2..6dd37b0 100755
--- a/support/download/file
+++ b/support/download/file
@@ -40,4 +40,4 @@ _localfiles() {
     eval ${LOCALFILES} "${@}"
 }
 
-_localfiles ${verbose} "'${dir}${file}'" "'${output}'"
+_localfiles ${verbose} "'${dir##file://}/${file}'" "'${output}'"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2] support/download/file: fix file:// protocol handling
  2018-05-08 13:28 [Buildroot] [PATCH v2] support/download/file: fix file:// protocol handling Angelo Compagnucci
@ 2018-05-08 13:34 ` Yann E. MORIN
  2018-05-08 13:40   ` Angelo Compagnucci
  2018-05-13 20:26 ` Thomas Petazzoni
  1 sibling, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2018-05-08 13:34 UTC (permalink / raw)
  To: buildroot

Angelo, All,

Thanks for the respin.

On 2018-05-08 15:28 +0200, Angelo Compagnucci spake thusly:
> When a file is used a source for download using the file:// protocol, a
> malformed url is passed to the file download script which then crashes.
> Following an example of a wrong path passed to the script:
> 
> eval cp -v ''\''file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2'\''' ''\''/home/angelo/DEV/BUILDROOT/br_qemu_arm/build/.armv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2.f403PT/output'\'''.
> 
> Path passed to cp lacks of a / between dir and file part of the url,
> moreover it presents a wrong file:// prefix.

Well, the misisng / is indeed incorrect.

However, the leading protocol is expected: the dl-wrapper calls all
backend scripts with the exact same set of options and semantics. It's
is then up to the backend scripts to interpret that as they see fit.

So, it is not "semantically wrong"; it *is* correct.

The bug lies in the fact that the 'file' backend did not strip out the
protocol part when calling the actual tool; we missed that during the
download overhaul.

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

Regards,
Yann E. MORIN.

> Fixes:
> 
> cp: cannot stat
> 'file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2':
> No such file or directory
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> ---
>  support/download/file | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/download/file b/support/download/file
> index fefd6d2..6dd37b0 100755
> --- a/support/download/file
> +++ b/support/download/file
> @@ -40,4 +40,4 @@ _localfiles() {
>      eval ${LOCALFILES} "${@}"
>  }
>  
> -_localfiles ${verbose} "'${dir}${file}'" "'${output}'"
> +_localfiles ${verbose} "'${dir##file://}/${file}'" "'${output}'"
> -- 
> 2.7.4
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2] support/download/file: fix file:// protocol handling
  2018-05-08 13:34 ` Yann E. MORIN
@ 2018-05-08 13:40   ` Angelo Compagnucci
  0 siblings, 0 replies; 4+ messages in thread
From: Angelo Compagnucci @ 2018-05-08 13:40 UTC (permalink / raw)
  To: buildroot

Dear Yann,

2018-05-08 15:34 GMT+02:00 Yann E. MORIN <yann.morin.1998@free.fr>:
> Angelo, All,
>
> Thanks for the respin.
>
> On 2018-05-08 15:28 +0200, Angelo Compagnucci spake thusly:
>> When a file is used a source for download using the file:// protocol, a
>> malformed url is passed to the file download script which then crashes.
>> Following an example of a wrong path passed to the script:
>>
>> eval cp -v ''\''file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2'\''' ''\''/home/angelo/DEV/BUILDROOT/br_qemu_arm/build/.armv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2.f403PT/output'\'''.
>>
>> Path passed to cp lacks of a / between dir and file part of the url,
>> moreover it presents a wrong file:// prefix.
>
> Well, the misisng / is indeed incorrect.
>
> However, the leading protocol is expected: the dl-wrapper calls all
> backend scripts with the exact same set of options and semantics. It's
> is then up to the backend scripts to interpret that as they see fit.
>
> So, it is not "semantically wrong"; it *is* correct.
>
> The bug lies in the fact that the 'file' backend did not strip out the
> protocol part when calling the actual tool; we missed that during the
> download overhaul.

Indeed I said "path passed to cp" not to the file backend. That is incorrect.

Should I rework my commit message?

>
> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>
> Regards,
> Yann E. MORIN.
>
>> Fixes:
>>
>> cp: cannot stat
>> 'file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2':
>> No such file or directory
>>
>> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
>> ---
>>  support/download/file | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/support/download/file b/support/download/file
>> index fefd6d2..6dd37b0 100755
>> --- a/support/download/file
>> +++ b/support/download/file
>> @@ -40,4 +40,4 @@ _localfiles() {
>>      eval ${LOCALFILES} "${@}"
>>  }
>>
>> -_localfiles ${verbose} "'${dir}${file}'" "'${output}'"
>> +_localfiles ${verbose} "'${dir##file://}/${file}'" "'${output}'"
>> --
>> 2.7.4
>>
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2] support/download/file: fix file:// protocol handling
  2018-05-08 13:28 [Buildroot] [PATCH v2] support/download/file: fix file:// protocol handling Angelo Compagnucci
  2018-05-08 13:34 ` Yann E. MORIN
@ 2018-05-13 20:26 ` Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2018-05-13 20:26 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue,  8 May 2018 15:28:31 +0200, Angelo Compagnucci wrote:
> When a file is used a source for download using the file:// protocol, a
> malformed url is passed to the file download script which then crashes.
> Following an example of a wrong path passed to the script:
> 
> eval cp -v ''\''file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2'\''' ''\''/home/angelo/DEV/BUILDROOT/br_qemu_arm/build/.armv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2.f403PT/output'\'''.
> 
> Path passed to cp lacks of a / between dir and file part of the url,
> moreover it presents a wrong file:// prefix.
> 
> Fixes:
> 
> cp: cannot stat
> 'file:///home/angelo/DEV/TOOLCHAINSarmv7-eabihf--glibc--bleeding-edge-2017.11-1.tar.bz2':
> No such file or directory
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> ---
>  support/download/file | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master after reworking the commit log. Thanks Angelo!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-13 20:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-08 13:28 [Buildroot] [PATCH v2] support/download/file: fix file:// protocol handling Angelo Compagnucci
2018-05-08 13:34 ` Yann E. MORIN
2018-05-08 13:40   ` Angelo Compagnucci
2018-05-13 20:26 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox