Skip to content

Commit df07f13

Browse files
sergiodjSergio Durigan Juniorpolkorny
authored
Fix curl version comparison (#78)
Thanks to @polkorny for identifying a bug in our curl version comparison algorithm! Previously, we'd have problems when curl bumps to version 9.0+ because our logic would wrongly try to match the minor version to "-ge 16", which wouldn't work until curl 9.16 is released. Polkorny gave the idea to compose the major and minor versions into one single number without the dot, which allows us to perform quick numerical comparisons. Signed-off-by: Sergio Durigan Junior <[email protected]> Reported-by: Matheus Polkorny <[email protected]> Co-Authored-by: Matheus Polkorny <[email protected]> Signed-off-by: Sergio Durigan Junior <[email protected]> Co-authored-by: Sergio Durigan Junior <[email protected]> Co-authored-by: Matheus Polkorny <[email protected]>
1 parent 11f840c commit df07f13

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

wcurl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,19 +210,21 @@ exec_curl()
210210

211211
CURL_NO_CLOBBER=""
212212
CURL_PARALLEL=""
213-
# --no-clobber is only supported since 7.83.0.
214-
# --parallel is only supported since 7.66.0.
215-
# --parallel-max-host is only supported since 8.16.0.
213+
216214
if [ "${curl_version_major}" -ge 8 ]; then
217215
CURL_NO_CLOBBER="--no-clobber"
218-
CURL_PARALLEL="--parallel"
219-
if [ "${curl_version_minor}" -ge 16 ]; then
220-
CURL_PARALLEL="--parallel --parallel-max-host 5"
216+
CURL_PARALLEL="--parallel --parallel-max-host 5"
217+
218+
# --parallel-max-host is only supported since 8.16.0.
219+
if [ "${curl_version_major}" -eq 8 ] && [ "${curl_version_minor}" -lt 16 ]; then
220+
CURL_PARALLEL="--parallel"
221221
fi
222222
elif [ "${curl_version_major}" -eq 7 ]; then
223+
# --no-clobber is only supported since 7.83.0.
223224
if [ "${curl_version_minor}" -ge 83 ]; then
224225
CURL_NO_CLOBBER="--no-clobber"
225226
fi
227+
# --parallel is only supported since 7.66.0.
226228
if [ "${curl_version_minor}" -ge 66 ]; then
227229
CURL_PARALLEL="--parallel"
228230
fi

0 commit comments

Comments
 (0)