diff options
author | Petr Štetiar <ynezz@true.cz> | 2022-09-13 07:40:37 +0200 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2022-09-21 11:52:40 +0200 |
commit | c07c565ea671e9929b99fbd28c58bde5f5e50070 (patch) | |
tree | 98169610b2c619ea8dceb877bc398c41f75d3e21 | |
parent | f14d7cef7cce3ce79b880f71b25e03e5fb844882 (diff) | |
download | upstream-c07c565ea671e9929b99fbd28c58bde5f5e50070.tar.gz upstream-c07c565ea671e9929b99fbd28c58bde5f5e50070.tar.bz2 upstream-c07c565ea671e9929b99fbd28c58bde5f5e50070.zip |
scripts/download.pl: fix downloads with wget
Several users of wget for downloads (curl is not available in the
system) have reported broken download functionality:
wget --tries=5 --timeout=20 --output-document=- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.142.tar.xz
http://: Invalid host name.
Thats all happening due to '' was passed as an argument, which got later
expanded to http://.
In the context of a list constructor '' is not nothing, it is an empty
string element. So fix it by using () as it will yield "nothing" and
thus not introduce an empty string element.
Fixes: #10692
Fixes: 90c6e3aedf16 ("scripts: always check certificates")
Signed-off-by: Jo-Philipp Wich <jo@mein.io> [shellwords() -> ()]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit 50a48faa1b8424e6b4b436b7118fffa2cba14b18)
-rwxr-xr-x | scripts/download.pl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/download.pl b/scripts/download.pl index 16f808da09..bfee84762d 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -84,8 +84,14 @@ sub download_cmd($) { } return $have_curl - ? (qw(curl -f --connect-timeout 20 --retry 5 --location), $check_certificate ? '' : '--insecure', shellwords($ENV{CURL_OPTIONS} || ''), $url) - : (qw(wget --tries=5 --timeout=20 --output-document=-), $check_certificate ? '' : '--no-check-certificate', shellwords($ENV{WGET_OPTIONS} || ''), $url) + ? (qw(curl -f --connect-timeout 20 --retry 5 --location), + $check_certificate ? () : '--insecure', + shellwords($ENV{CURL_OPTIONS} || ''), + $url) + : (qw(wget --tries=5 --timeout=20 --output-document=-), + $check_certificate ? () : '--no-check-certificate', + shellwords($ENV{WGET_OPTIONS} || ''), + $url) ; } |