Skip to content

Fix multiple bugs, add perf optimizations, and update docs (v1.11.0)#261

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fixup-tool-update
Draft

Fix multiple bugs, add perf optimizations, and update docs (v1.11.0)#261
Copilot wants to merge 2 commits into
masterfrom
copilot/fixup-tool-update

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 10, 2026

Addresses a collection of actionable open issues and PRs: wrong exit code on socks proxy fallback, empty proxy vars breaking apt-listbugs, read-only subcommands blocked by the write lock, and stale documentation.

Bug fixes

Performance (from PR #253)

  • Conditional urldecode: removed the dedicated function; inlines printf '%b' only when % is present in the filename, skipping the subshell for the common case.
  • Early auth short-circuit: prepare_auth sets APT_FAST_APT_AUTH=0 when no credentials are parsed, eliminating per-URI get_auth subshell calls for the majority of users.
  • Deferred numfmt: file sizes are stored as raw integers in DOWNLOAD_DISPLAY; formatting is applied once in display_downloadfile via numfmt --field=3 on the sorted stream instead of per-package during URI collection.
  • += / (( )) used for string/integer accumulation in the hot loop.

Documentation

  • README version header updated to 1.11.
  • Debian/derivatives PPA instructions migrated from deprecated .list to deb822 .sources format; URL switched to HTTPS (ppa.launchpadcontent.net).
  • Removed dead link to mattparnell.com.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…rf opts, README updates

Co-authored-by: ilikenwf <414778+ilikenwf@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues and update the tool Fix multiple bugs, add perf optimizations, and update docs (v1.11.0) Mar 10, 2026
@ilikenwf
Copy link
Copy Markdown
Owner

Is this all something you may be capable of testing? I no longer run any non-managed debian based machines. If not I'll need some guinea pigs to test this out sometime.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates apt-fast to v1.11.0, fixing several behavioral bugs (exit codes, proxy handling, lock behavior) and improving performance in the URI parsing/display path, with corresponding documentation updates.

Changes:

  • Fix exit-status propagation on SOCKS proxy fallback and avoid exporting empty proxy variables.
  • Treat show/search/list/changelog/help as read-only commands to bypass the write lock and downloader-related checks.
  • Optimize hot paths in URI/auth handling and download-size display (conditional decoding, fewer subshells, deferred numfmt).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
apt-fast Implements bug fixes (exit code + proxy handling), adds read-only mode lock bypass, and applies performance optimizations in get_uris/display_downloadfile.
README.md Updates version header and refreshes Debian/derivative installation instructions to deb822 .sources format and HTTPS PPA URL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apt-fast
Comment on lines 603 to 609
# aria2 has no socks support (see https://github.com/aria2/aria2/issues/153)
if echo "$http_proxy" | grep -q "^socks5h://" || echo "$https_proxy" | grep -q "^socks5h://"; then
msg "Socks proxy detected. Falling back to ${_APTMGR}" "hint"
"${_APTMGR}" "${APT_SCRIPT_WARNING[@]}" "$@"
CLEANUP_STATE=$?
exit
fi
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

In the socks-proxy fallback block, CLEANUP_STATE=$?; exit relies on the EXIT trap to propagate the package manager’s exit code. For option="readonly", _create_lock isn’t called so no EXIT trap is installed, and exit will return the status of the last assignment (0), masking failures. Consider exiting explicitly with the captured status (e.g., exit "$CLEANUP_STATE") or skipping this socks-proxy fallback entirely for read-only commands.

Copilot uses AI. Check for mistakes.
Comment thread apt-fast
Comment on lines +597 to +601
# Only export proxy variables if they are non-empty; exporting empty proxy
# variables can confuse tools like apt-listbugs with "unsupported proxy ''" errors.
[ -n "$ftp_proxy" ] && export ftp_proxy || unset ftp_proxy
[ -n "$http_proxy" ] && export http_proxy || unset http_proxy
[ -n "$https_proxy" ] && export https_proxy || unset https_proxy
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The proxy handling now uses unset ftp_proxy/http_proxy/https_proxy when the value is empty. This loses the script’s earlier distinction between “set but empty” vs “unset” (preserved across sudo) and can change behavior for tools that fall back to HTTP_PROXY/HTTPS_PROXY when the lowercase vars are unset. To avoid exporting empty proxies while keeping semantics stable, prefer removing the export attribute (e.g., export -n var) or otherwise keep the shell variable defined but unexported when empty.

Copilot uses AI. Check for mistakes.
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.

3 participants