Skip to content

dotnet-install.sh: line 1172: http_code: unbound variable #626

@akoeplinger

Description

@akoeplinger

Happened in https://dev.azure.com/dnceng-public/public/_build/results?buildId=1103973&view=logs&j=269f5d52-982b-5966-fca9-1b2b0a5feb6e&t=5635d2d0-8bb9-5f32-5791-31370b616264&l=3746 / dotnet/runtime#118278

From looking at the code this can happen if the timeout case occurs because then we don't set the http_code variable:

# Check for curl timeout codes
if [[ $curl_exit_code == 7 || $curl_exit_code == 28 ]]; then
download_error_msg+=" Failed to reach the server: connection timeout."
else
local disable_feed_credential=false
local response=$(get_http_header_curl $remote_path $disable_feed_credential)
http_code=$( echo "$response" | awk '/^HTTP/{print $2}' | tail -1 )
if [[ ! -z $http_code && $http_code != 2* ]]; then
download_error_msg+=" Returned HTTP status code: $http_code."
fi
fi

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions