Skip to content

Check for awk before resolving or downloading - #749

Open
celinhodaltro wants to merge 1 commit into
dotnet:mainfrom
celinhodaltro:fix/awk-prereq
Open

celinhodaltro wants to merge 1 commit into
dotnet:mainfrom
celinhodaltro:fix/awk-prereq

Conversation

@celinhodaltro

Copy link
Copy Markdown

Fixes #746.

dotnet-install.sh silently assumes awk: it parses the aka.ms redirect (get_download_link_from_aka_ms), the HTTP status codes (downloadcurl/downloadwget), the Content-Length and the SDK version in global.json. On an image without awk (mcr.microsoft.com/azurelinux/core:4, for example) the first confusing symptom is a shell error inside the download, long after the script has accepted the environment.

check_min_reqs now checks for awk right after curl/wget, so a missing prerequisite is reported once, up front.

I checked where awk is used before adding a hard requirement: every download path parses HTTP codes or the redirect with it, and --jsonfile needs it to read the SDK version, so there is no meaningful install flow that can skip it.

Verified

On a shell whose PATH has no awk:

$ ./dotnet-install.sh -c 10.0 --dry-run
dotnet_install: Error: awk is required to download and install dotnet. Install awk (for example the 'gawk' or 'mawk' package) and try again.

With awk present, the same command still resolves:

$ ./dotnet-install.sh -c 10.0 --dry-run
dotnet-install: Repeatable invocation: ./dotnet-install.sh --version "10.0.403" ...

ScriptEncodingTests (2/2) passes, so the line endings the repository requires (*.sh = LF) are intact.

The script uses awk to parse the aka.ms redirect, the HTTP status
codes, the Content-Length and the version in global.json. Images such
as mcr.microsoft.com/azurelinux/core:4 do not ship awk, and the
failure only surfaced deep inside the download as a shell error about
a missing command.

awk is now checked next to curl and wget, with the same kind of
prerequisite message.

Fix dotnet#746
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

dotnet-install.sh depends on awk without checking for it

2 participants