scripts: previous_release: improve behaviour on failed download #18426

pull theStack wants to merge 1 commits into bitcoin:master from theStack:20200324-scripts-previous-release-show-error-message-if-download-fails changing 1 files +4 −1
  1. theStack commented at 10:20 PM on March 24, 2020: member

    Currently, if the earlier release build/fetch script previous_release.sh is invoked with the option -b (intending to fetch a binary package from https://bitcoin.org) and the download fails, the user sees the following confusing output:

    $ contrib/devtools/previous_release.sh -r -b v0.9.5
    [...]
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    

    This implies that the download worked, but the archive is corrupted, when in reality the HTML document containing the delivery fail reason (most likely 404 Not Found) is saved and tried to get unpacked. In contrast to wget, curl is a bit stubborn and needs explicit instructions to react to server errors via the flag -f (outputs error message and returns error code, ideal for scripts): https://curl.haxx.se/docs/manpage.html#-f

    On the PR branch, the output on failed download looks now the following:

    $ contrib/devtools/previous_release.sh -r -b v0.9.5
    [...]
    curl: (22) The requested URL returned error: 404 Not Found
    Download failed.
    
  2. fanquake added the label Scripts and tools on Mar 24, 2020
  3. in contrib/devtools/previous_release.sh:143 in b92eeeb9d4 outdated
     138 | @@ -139,7 +139,11 @@ pushd "$TARGET" || exit 1
     139 |          fi
     140 |          URL="https://bitcoin.org/$BIN_PATH/bitcoin-${tag:1}-$PLATFORM.tar.gz"
     141 |          echo "Fetching: $URL"
     142 | -        curl -O $URL
     143 | +        curl -O -f $URL
     144 | +        if [ $? -ne 0 ]; then
    


    DrahtBot commented at 12:04 AM on March 25, 2020:
             if [ $? -ne 0 ]; then
                 ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
    

    theStack commented at 8:08 AM on March 25, 2020:

    Thanks DrahtBot for your virtual assistance, fixed :smile:

  4. [scripts] previous_release: improve failed download error message
    before:
    ------------------------------------------------------------
    $ contrib/devtools/previous_release.sh -r -b v0.9.5
    [...]
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    ------------------------------------------------------------
    
    now:
    ------------------------------------------------------------
    $ contrib/devtools/previous_release.sh -r -b v0.9.5
    [...]
    curl: (22) The requested URL returned error: 404 Not Found
    Download failed.
    ------------------------------------------------------------
    332f373a9d
  5. theStack force-pushed on Mar 25, 2020
  6. theStack commented at 5:58 PM on April 2, 2020: member

    ping @Sjors

  7. fanquake approved
  8. fanquake commented at 10:10 AM on April 3, 2020: member

    ACK 332f373a9dece71717f75eb06e6a1fc957f2952b

    master:

    contrib/devtools/previous_release.sh -r -b v0.9.5
    Releases directory: releases
    ~/bitcoin/releases ~/bitcoin
    Fetching: https://bitcoin.org/bin/bitcoin-core-0.9.5/bitcoin-0.9.5-osx64.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   162  100   162    0     0    110      0  0:00:01  0:00:01 --:--:--   110
    tar: Unrecognized archive format
    tar: bitcoin-0.9.5: Not found in archive
    tar: Error exit delayed from previous errors.
    

    pr:

    contrib/devtools/previous_release.sh -r -b v0.9.5
    Releases directory: releases
    ~/bitcoin/releases ~/bitcoin
    Fetching: https://bitcoin.org/bin/bitcoin-core-0.9.5/bitcoin-0.9.5-osx64.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
    curl: (22) The requested URL returned error: 404 Not Found
    Download failed.
    
  9. fanquake merged this on Apr 3, 2020
  10. fanquake closed this on Apr 3, 2020

  11. Sjors commented at 12:29 PM on April 3, 2020: member

    Post merge utACK

  12. sidhujag referenced this in commit 9e0c5c1890 on Apr 3, 2020
  13. theStack deleted the branch on Dec 1, 2020
  14. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me