Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion util/build-deps.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,16 @@ distfiles_fetch () {

# If the file exists but didn't pass check, or doesn't exist, we download it using -c (continue)
notice "Fetching for ${package}-${DISTVERS[$package]}"
wget -c -O ${distfile} ${DISTS[$package]}
if command -v curl >/dev/null 2>&1; then
curl -f -L -C - -o ${distfile} ${DISTS[$package]}
elif command -v wget >/dev/null 2>&1; then
wget -c -O ${distfile} ${DISTS[$package]}
elif command -v fetch >/dev/null 2>&1; then
fetch -o ${distfile} ${DISTS[$package]}
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The comment above says the download should use a continue/resume option ("-c"), but the fetch branch currently downloads without a resume flag. On BSD/macOS with large distfiles this can force a full re-download after an interrupted fetch. Consider using fetch's equivalent continue option (e.g., -C where supported) to match the intended behavior of the other branches.

Suggested change
fetch -o ${distfile} ${DISTS[$package]}
fetch -C -o ${distfile} ${DISTS[$package]}

Copilot uses AI. Check for mistakes.
Comment on lines +175 to +179
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The downloader invocations pass ${distfile} and ${DISTS[$package]} unquoted. If ${DISTDIR}/${HOME} contains spaces or glob characters, this can break downloads or write to an unexpected path. Quoting these parameters (and generally avoiding word-splitting) would make the fetch logic more robust.

Copilot uses AI. Check for mistakes.
else
notice "No suitable download tool (curl, wget, or fetch) found! Bailing!"
exit 1
fi
Comment on lines +174 to +183
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

To improve the robustness and consistency of the download logic, I recommend the following improvements:

  1. Quoting: Double-quote ${distfile} and ${DISTS[$package]} to prevent issues with word splitting or globbing if paths or URLs contain spaces. This is a standard best practice for shell scripts to ensure robustness across different environments.
  2. Fetch Resume: Add the -r flag to the fetch command. This enables resuming interrupted downloads, matching the behavior of curl -C - and wget -c as intended by the comment on line 172.
Suggested change
if command -v curl >/dev/null 2>&1; then
curl -f -L -C - -o ${distfile} ${DISTS[$package]}
elif command -v wget >/dev/null 2>&1; then
wget -c -O ${distfile} ${DISTS[$package]}
elif command -v fetch >/dev/null 2>&1; then
fetch -o ${distfile} ${DISTS[$package]}
else
notice "No suitable download tool (curl, wget, or fetch) found! Bailing!"
exit 1
fi
if command -v curl >/dev/null 2>&1; then
curl -f -L -C - -o "${distfile}" "${DISTS[$package]}"
elif command -v wget >/dev/null 2>&1; then
wget -c -O "${distfile}" "${DISTS[$package]}"
elif command -v fetch >/dev/null 2>&1; then
fetch -r -o "${distfile}" "${DISTS[$package]}"
else
notice "No suitable download tool (curl, wget, or fetch) found! Bailing!"
exit 1
fi


if distfiles_sum MD5 ${package} && distfiles_sum SHA256 ${package}; then
return 0
Expand Down
Loading