Improve Windows hosts update reliability and add desktop recovery flow#3
Merged
fjh1997 merged 5 commits intofjh1997:mainfrom Mar 25, 2026
Conversation
Owner
|
Reopening to trigger CI after adding PR workflow on main. |
Owner
|
感谢这个 PR,方向是对的,尤其是 Windows hosts 写入重试、备份元数据和恢复入口这块,补得很扎实。 我这边看完后,顺手直接往你的分支补了一次修正,提交是
本地我补跑了你 PR 里同样的校验:
结果都通过了。你看下这版修正是否符合你原本想要的行为,如果没问题我这边就按这个方向继续审。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #1
背景
hosts文件在提权流程里被其他进程短暂占用,导致原子替换失败(os error 32/ sharing violation)。这次改了什么
hosts基线备份 /restore-hosts/cleanup流程hosts时处理只读属性,并为原子替换增加共享冲突重试cleanup在备份缺失、损坏或状态异常时会自动退化为清理托管 block,并重置失效备份,避免后续一直卡死operations.log,便于继续定位 Windows 机器上的现场问题为什么这样改
issue #1 表面上看到的是:
elevation or command execution failedelevated command exited with code 1但继续往下看,真实问题并不一定是“没拿到管理员权限”,还有一类情况是:
C:\Windows\System32\drivers\etc\hosts在替换瞬间被别的进程占用所以这次除了提升 Windows 写入兼容性,也把“备份 -> 恢复 -> 彻底清理 -> 再次尝试”的闭环补齐了。
当前验证
cargo test --release --locked --lib --target-dir target/pr-verify cargo build --release --locked --bin linuxdo-accelerator --target-dir target/pr-verify本地验证结果: