contrib/install_db4.sh: http_get if tar.gz does not exist #23449

pull RandyMcMillan wants to merge 1 commits into bitcoin:master from RandyMcMillan:install-db4-check changing 1 files +3 −1
  1. RandyMcMillan commented at 2:40 AM on November 6, 2021: contributor

    No description provided.

  2. RandyMcMillan commented at 2:41 AM on November 6, 2021: contributor
    ./contrib/install_db4.sh `pwd`
    

    fails if db-4.8.30.NC.tar.gz exists

  3. RandyMcMillan force-pushed on Nov 6, 2021
  4. RandyMcMillan force-pushed on Nov 6, 2021
  5. RandyMcMillan force-pushed on Nov 6, 2021
  6. RandyMcMillan force-pushed on Nov 6, 2021
  7. RandyMcMillan force-pushed on Nov 6, 2021
  8. DrahtBot added the label Scripts and tools on Nov 6, 2021
  9. lsilva01 commented at 4:15 AM on November 6, 2021: contributor

    Concept ACK

  10. in contrib/install_db4.sh:67 in c85909a3fe outdated
      62 | @@ -63,8 +63,12 @@ http_get() {
      63 |  }
      64 |  
      65 |  mkdir -p "${BDB_PREFIX}"
      66 | -http_get "${BDB_URL}" "${BDB_VERSION}.tar.gz" "${BDB_HASH}"
      67 | -tar -xzvf ${BDB_VERSION}.tar.gz -C "$BDB_PREFIX"
      68 | +if [ -f "${BDB_VERSION}.tar.gz" ]; then
      69 | +    tar -xzvf ${BDB_VERSION}.tar.gz -C "$BDB_PREFIX"
    


    MarcoFalke commented at 8:57 AM on November 6, 2021:

    So this will skip the BDB_HASH check?

  11. katesalazar commented at 4:16 PM on November 6, 2021: contributor
    ./contrib/install_db4.sh `pwd`
    

    fails if db-4.8.30.NC.tar.gz exists

    Then there is something wrong in lines 54 and 55, right?

    https://github.com/bitcoin/bitcoin/blob/77a2f5d30c5ecb764b8a7c098492e1f5cdec90f0/contrib/install_db4.sh#L54-L55

    The fix would be in those two lines, not out of the scope of http_get.

    How does it fail exactly?

  12. contrib/install_db4.sh: http_get if tar.gz does not exist 2d25426e8e
  13. in contrib/install_db4.sh:66 in c85909a3fe outdated
      62 | @@ -63,8 +63,12 @@ http_get() {
      63 |  }
      64 |  
      65 |  mkdir -p "${BDB_PREFIX}"
      66 | -http_get "${BDB_URL}" "${BDB_VERSION}.tar.gz" "${BDB_HASH}"
      67 | -tar -xzvf ${BDB_VERSION}.tar.gz -C "$BDB_PREFIX"
      68 | +if [ -f "${BDB_VERSION}.tar.gz" ]; then
    


    laanwj commented at 11:21 AM on November 8, 2021:

    For the current logic it would imo be better to write it as a negation so that the tar can be factored out:

    if [ ! -f "${BDB_VERSION}.tar.gz" ]; then
        http_get "${BDB_URL}" "${BDB_VERSION}.tar.gz" "${BDB_HASH}"
    fi
    tar -xzvf ${BDB_VERSION}.tar.gz -C "$BDB_PREFIX"
    

    I agree that checking the hash would make (some) sense even if the file exists, though.


    katesalazar commented at 7:55 PM on November 8, 2021:

    For the current logic it would imo be better to write it as a negation so that the tar can be factored out:

    if [ ! -f "${BDB_VERSION}.tar.gz" ]; then
        http_get "${BDB_URL}" "${BDB_VERSION}.tar.gz" "${BDB_HASH}"
    fi
    tar -xzvf ${BDB_VERSION}.tar.gz -C "$BDB_PREFIX"
    

    That suggestion is good if http_get exits upon failure.

    You are not proposing any error control on the tar exit status, are you? It would fail if http_get fails what is supposed to do.


    RandyMcMillan commented at 7:43 AM on November 9, 2021:

    changed to if not exist logic

  14. RandyMcMillan force-pushed on Nov 9, 2021
  15. RandyMcMillan renamed this:
    contrib/install_db4.sh: check if tar exists
    contrib/install_db4.sh: check if tar.gz does not exist
    on Nov 9, 2021
  16. RandyMcMillan renamed this:
    contrib/install_db4.sh: check if tar.gz does not exist
    contrib/install_db4.sh: http_get if tar.gz does not exist
    on Nov 9, 2021
  17. jamesob commented at 3:22 PM on November 9, 2021: member

    I don't understand - isn't the existing file case already covered in http_get? https://github.com/bitcoin/bitcoin/blob/master/contrib/install_db4.sh#L54-L55

  18. katesalazar commented at 3:50 PM on November 9, 2021: contributor

    More generally, could only apply tar extraction unconditionally if http_get performs an infinite loop broken when the file is downloaded, not only downloaded but until sha256_check is satisfactory as well, keeping trying new downloads on corrupted download or unexpected content.

    Or do http_get and sha256_check abort the whole script when returning unsuccessfully?

  19. RandyMcMillan marked this as a draft on Nov 9, 2021
  20. RandyMcMillan commented at 5:05 PM on November 9, 2021: contributor

    Closed - Maybe there was an anomily with MacOS M1 bash shell or the download was being corrupted (thru a vpn).

  21. RandyMcMillan closed this on Nov 9, 2021

  22. DrahtBot locked this on Nov 9, 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-17 15:14 UTC

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