Fix multiple bugs, add perf optimizations, and update docs (v1.11.0)#261
Fix multiple bugs, add perf optimizations, and update docs (v1.11.0)#261Copilot wants to merge 2 commits into
Conversation
…rf opts, README updates Co-authored-by: ilikenwf <414778+ilikenwf@users.noreply.github.com>
|
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. |
There was a problem hiding this comment.
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/helpas 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.
| # 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 |
There was a problem hiding this comment.
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.
| # 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 |
There was a problem hiding this comment.
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.
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
exitafter_APTMGRfallback discarded the manager's exit code. Fixed by capturingCLEANUP_STATE=$?beforeexitso the EXIT trap propagates it correctly.apt-listbugswithapt-fastalways fails #256):http_proxy/https_proxy/ftp_proxywere unconditionally exported even when empty, causingE: unsupported proxy ''. Now only exported when non-empty; unset otherwise.showshould not be blocked by lock file: apt-fast already running! #197, FIX #minor apt-fastsearchshould not be blocked by lock file: apt-fast already running! #198):show,search,changelog,list,helpnow setoption="readonly", which bypasses the lock existence check, lock creation, downloader availability check, and aria2c hash detection — none of which are needed for passthrough-only commands.Performance (from PR #253)
urldecode: removed the dedicated function; inlinesprintf '%b'only when%is present in the filename, skipping the subshell for the common case.prepare_authsetsAPT_FAST_APT_AUTH=0when no credentials are parsed, eliminating per-URIget_authsubshell calls for the majority of users.numfmt: file sizes are stored as raw integers inDOWNLOAD_DISPLAY; formatting is applied once indisplay_downloadfilevianumfmt --field=3on the sorted stream instead of per-package during URI collection.+=/(( ))used for string/integer accumulation in the hot loop.Documentation
.listto deb822.sourcesformat; URL switched to HTTPS (ppa.launchpadcontent.net).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.