Skip to content

[bug][windows] Edge release exe fails with "failed to locate CLI binary" (hash-named asset + packager collision) #21

Description

@MagicSnake0503

环境

  • 平台:Windows 11 x64
  • 版本:edge pre-release(78c6f9eb453d),资产 linuxdo-accelerator-78c6f9eb453d-windows-x64.exe

现象

下载 edge release 的 Windows 资产,双击运行(预置 config 绕过 #20 的首跑问题后)GUI 可正常打开,但点击「开始加速」后:

  • operations.log 中只有 GUI 已发起管理员操作请求,随后 service-state.json 报:
{ "running": false, "last_error": "failed to locate CLI binary" }
  • 证书已生成,但 hosts 未写入、daemon 未启动。

根因 1:exe 文件名硬编码

src/service.rscurrent_cli_binary() 要求当前 exe 或其同目录 sibling 必须名为 linuxdo-accelerator.exe

fn current_cli_binary() -> Result<PathBuf> {
    if let Ok(path) = std::env::current_exe() {
        let sibling = path.with_file_name(cli_binary_name()); // "linuxdo-accelerator.exe"
        if sibling.exists() { return Ok(sibling); }
        if path.file_name()... == cli_binary_name() { return Ok(path); }
    }
    bail!("failed to locate CLI binary")
}

而 edge release 的 Windows 资产文件名是 hash 命名的(linuxdo-accelerator-78c6f9eb453d-windows-x64.exe),helper 提权后在 spawn daemon 前调用此函数必然失败。实测把文件重命名为 linuxdo-accelerator.exe 后该步骤立即通过。

根因 2:发布流程资产撞名,NSIS 安装包被裸 exe 覆盖

.github/workflows/publish-edge-pre-release.yml 的发布步骤把 dist/**(cargo-packager 输出的 NSIS 安装包)与 target/release/linuxdo-accelerator.exe(裸二进制)都收集为 *.exe,重命名循环里两者都映射到同一个目标名:

linuxdo-accelerator-<hash>-windows-x64.exe

后一个覆盖前一个,最终发布出去的是裸 exe(实测 17.9MB,PE32+ GUI 子系统、无 NSIS 特征)。如果发布的是 NSIS 安装包,安装后文件名即 linuxdo-accelerator.exe,根因 1 也就不会触发。

建议修复

  • 发布脚本为两种产物使用不同命名(如 -setup.exe-portable.exe),或只发布安装包;
  • current_cli_binary() 兜底直接返回 std::env::current_exe(),不校验文件名(对便携版更友好)。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions