Skip to content

build: compress download - #7

Merged
datbth merged 4 commits into
refactor/contextfrom
build/compress
Jul 23, 2026
Merged

build: compress download#7
datbth merged 4 commits into
refactor/contextfrom
build/compress

Conversation

@datbth

@datbth datbth commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@datbth
datbth requested a review from khanhhuy as a code owner July 23, 2026 11:47

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the update and installation processes to download and decompress gzip-compressed release binaries instead of uncompressed ones. Feedback on the changes suggests using gunzip -c or gzip -dc and redirecting the output to the target filename explicitly in install.sh to prevent issues with unexpected output filenames caused by gzip headers or environment variables.

Comment thread install.sh Outdated
Comment on lines +31 to +34
if command -v gunzip >/dev/null 2>&1; then
gunzip_cmd="gunzip"
elif command -v gzip >/dev/null 2>&1; then
gunzip_cmd="gzip -d"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using gunzip or gzip -d directly on the file can sometimes cause issues if the GZIP environment variable is set (e.g., with --name or -N) or if the platform's default behavior is to restore the original filename stored in the gzip header. This would result in a decompressed file with a different name (e.g., anfra-linux-x64 instead of anfra), causing subsequent steps to fail.

To prevent this, we can configure the commands to output to stdout (-c or -dc) and redirect the output to the target filename explicitly.

Suggested change
if command -v gunzip >/dev/null 2>&1; then
gunzip_cmd="gunzip"
elif command -v gzip >/dev/null 2>&1; then
gunzip_cmd="gzip -d"
if command -v gunzip >/dev/null 2>&1; then
gunzip_cmd="gunzip -c"
elif command -v gzip >/dev/null 2>&1; then
gunzip_cmd="gzip -dc"

Comment thread install.sh Outdated
Comment on lines +75 to +77
if ! $gunzip_cmd "${tmp}/${BIN_NAME}.gz"; then # -> ${tmp}/${BIN_NAME}
err "failed to decompress ${asset}"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Redirect the decompressed output to the target filename explicitly to ensure the output file is always named ${BIN_NAME} regardless of the original filename stored in the gzip header or any user-configured environment variables.

Suggested change
if ! $gunzip_cmd "${tmp}/${BIN_NAME}.gz"; then # -> ${tmp}/${BIN_NAME}
err "failed to decompress ${asset}"
fi
if ! $gunzip_cmd "${tmp}/${BIN_NAME}.gz" > "${tmp}/${BIN_NAME}"; then
err "failed to decompress ${asset}"
fi

@datbth
datbth merged commit d8c0948 into main Jul 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants