curl check regression #467

Closed
opened 2025-12-29 01:25:50 +01:00 by adam · 0 comments
Owner

Originally created by @krayon on GitHub (Mar 16, 2020).

Commit 0af7f388d6 added an error code check for
older curl versions that return an initialisation error (2) on version check.
From my tests 7.10 from 2002 is the last to do this I believe FYI:

    check exitcode of `curl -V` because of some issue with ancient versions of curl returning error codes on checking the version number

+  # curl returns with an error code in some ancient versions so we have to catch that
+  set +e
+  curl -V > /dev/null 2>&1
+  set -e
+  retcode="$?"
+  if [[ ! "${retcode}" = "0" ]] && [[ ! "${retcode}" = "2" ]]; then
+    _exiterr "This script requires curl."
+  fi

A regression was introduced in 68274646bb , that
breaks the retcode assignment as it's now coming from the awk, not the
curl:

    curl: use custom user agent (temporarily using a bit of 1337)

-  curl -V > /dev/null 2>&1
+  CURL_VERSION="$(curl -V 2>&1 | head -n1 | awk '{print $2}')"
Originally created by @krayon on GitHub (Mar 16, 2020). Commit 0af7f388d6e63e74920e5f0cc9ae21f717d223d1 added an error code check for older curl versions that return an initialisation error (2) on version check. From my tests 7.10 from 2002 is the last to do this I believe FYI: ```diff check exitcode of `curl -V` because of some issue with ancient versions of curl returning error codes on checking the version number + # curl returns with an error code in some ancient versions so we have to catch that + set +e + curl -V > /dev/null 2>&1 + set -e + retcode="$?" + if [[ ! "${retcode}" = "0" ]] && [[ ! "${retcode}" = "2" ]]; then + _exiterr "This script requires curl." + fi ``` A regression was introduced in 68274646bbb40e733d9fb5f3b0590d124a3aaea9 , that breaks the `retcode` assignment as it's now coming from the `awk`, not the `curl`: ```diff curl: use custom user agent (temporarily using a bit of 1337) - curl -V > /dev/null 2>&1 + CURL_VERSION="$(curl -V 2>&1 | head -n1 | awk '{print $2}')" ```
adam closed this issue 2025-12-29 01:25:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dehydrated#467