GNU bug report logs - #48233
[PATCH 0/3] Modest improvements to the guix-install.sh script.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Wed, 5 May 2021 04:18:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 48233-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 48233-done <at> debbugs.gnu.org
Subject: Re: [bug#48233] [PATCH 1/3] guix-install.sh: Please the shellcheck
 linter.
Date: Wed, 05 May 2021 11:00:42 -0400
Hi Julien,

Julien Lepiller <julien <at> lepiller.eu> writes:

> Le 5 mai 2021 00:32:00 GMT-04:00, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> a écrit :
>>
>>     wget --help | grep -q '\--show-progress' && \
>>         _PROGRESS_OPT="-q --show-progress" || _PROGRESS_OPT=""
>>-    wget $_PROGRESS_OPT -P "$dl_path" "${url}/${bin_ver}.tar.xz"
>>"${url}/${bin_ver}.tar.xz.sig"
>>
>>-    if [[ "$?" -eq 0 ]]; then
>>-       _msg "${PAS}download completed."
>>+    if wget "$_PROGRESS_OPT" -P "$dl_path" \
>>+            "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig";
>
> "$_PROGRESS_OPT" gets expanded to a single "-q --show-progress", which I doubt exists in wget :). The previous version didn't have quotes.

Good catch!  I failed to see that in my testing due to using the
GUIX_RELEASE_FILE_NAME trick, which shortcuts that procedure.

I've fixed it with an array:

--8<---------------cut here---------------start------------->8---
1 file changed, 4 insertions(+), 3 deletions(-)
etc/guix-install.sh | 7 ++++---

modified   etc/guix-install.sh
@@ -266,15 +266,16 @@ guix_get_bin()
     local url="$1"
     local bin_ver="$2"
     local dl_path="$3"
+    local wget_args=()

     _debug "--- [ ${FUNCNAME[0]} ] ---"

     _msg "${INF}Downloading Guix release archive"

-    wget --help | grep -q '\--show-progress' && \
-        _PROGRESS_OPT="-q --show-progress" || _PROGRESS_OPT=""
+    wget --help | grep -q '\--show-progress' \
+        && wget_args=("-q" "--show-progress")

-    if wget "$_PROGRESS_OPT" -P "$dl_path" \
+    if wget "${wget_args[@]}" -P "$dl_path" \
             "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig"; then
         _msg "${PAS}download completed."
     else
--8<---------------cut here---------------end--------------->8---

And in another VM (RHEL8) with up-to-date certs to be able to fetch from
the alpha.gnu.org :-).  The install went fine.

Pushed, thank you!

Maxim




This bug report was last modified 4 years and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.