Skip to content

fix(cli): gate Linux-only self-update symbols behind cfg(unix) - #2572

Open
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-selfupdate-unix-gate
Open

fix(cli): gate Linux-only self-update symbols behind cfg(unix)#2572
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-selfupdate-unix-gate

Conversation

@1688mengdie

Copy link
Copy Markdown

Summary

Fixes #2566

Gate the eight Linux-only symbols of the CLI self-update module behind #[cfg(unix)]: the imports flate2::read::GzDecoder / std::io::Cursor / tar::Archive (lines 2/8/12), the DEPRECATION_WARNING const, and the find_package_dir / validate_entrypoint_pair / validate_plugin_host_resources / copy_plugin_host_resources helpers.

The module only performs a real installation on Linux (install_archive is behind #[cfg(unix)] with a #[cfg(not(unix))] stub twin), so on Windows builds rustc reported all eight symbols as unused imports / dead code in the CI logs (see issue #2566 for the run evidence with file:line and rule names).

Type and Areas

Type: bug fix (build warnings cleanup)

Areas: Rust CLI

Motivation / Impact

No direct user-facing change. The Linux self-update path is untouched; Windows/non-Unix builds stop emitting 8 unused-import/dead-code warnings that currently pollute every full CI run of main. This also keeps the codebase ready in case a -D warnings gate is ever introduced.

Verification

  • cargo check --locked -p bitfun-cli on Windows: exit 0, warnings for the self_update module gone (baseline 19 warnings for the crate down to 11; the remaining ones are other symbols covered by separate PRs).
  • After the change, grep -c '#\[cfg(unix)\]' src/apps/cli/src/self_update.rs reports 9 (8 new gates + the pre-existing install_archive gate); cross-platform live paths (spawn_detached_install, update_from_configured_sources) are untouched.
  • linux-only compile surface of the gated symbols depends on the CI ubuntu/macos runners: the Rust Build Check / CLI Tests jobs on ubuntu/macos should confirm the Linux install path still compiles with the gates in place (n/a locally — no Linux/macOS machine available; the platform matrix in CI is exactly the place this gets verified).

Reviewer Notes

  • Single file, +8 attribute lines, zero deletions, zero behavior change: the diff only adds #[cfg(unix)] above declarations whose consumers are all inside the #[cfg(unix)] install path.
  • No #[allow] suppression is introduced.
  • AI-assisted change, lightly tested (cargo check on Windows only; cross-platform behavior verified by CI).

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable. (n/a — no user-facing change)

The CLI self-update module installs only on Linux: install_archive has a
#[cfg(not(unix))] stub twin and every consumer of GzDecoder, Cursor,
Archive, DEPRECATION_WARNING, find_package_dir, validate_entrypoint_pair,
validate_plugin_host_resources and copy_plugin_host_resources lives in the
#[cfg(unix)] install path. On Windows builds rustc therefore reports these
symbols as unused/dead code (unused import `flate2::read::GzDecoder`,
`std::io::Cursor`, `tar::Archive`, unused const `DEPRECATION_WARNING`,
dead functions `find_package_dir`, `validate_entrypoint_pair`,
`validate_plugin_host_resources`, `copy_plugin_host_resources` in the
upstream CI build logs).

Gate exactly these eight symbols with #[cfg(unix)] so Windows builds no
longer emit the warnings while the Linux install path stays unchanged.

Adopted-from: taiji 8082098 (import/const gate hunks) and taiji
931acc0 (validate/copy_plugin_host_resources gate hunks).

Test: cargo check --locked -p bitfun-cli on Windows, exit 0, no remaining
warnings for the self_update module.
AI: implemented with AI assistance, lightly tested (cargo check only).
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.

[Bug]: Unused/dead-code warnings for all 8 Linux-only symbols in CLI self_update module on Windows builds

1 participant