Skip to content

Bug: VersionRange.GetUpdatePath() 无限循环 #7

Description

@ModerRAS

Bug 描述

VersionRange.GetUpdatePath() 在检查增量更新包时会出现无限循环。

复现步骤

  1. 创建增量更新包链(每个包 IsCumulative=false)
  2. 运行 --check 命令检查更新
  3. 程序进入无限循环

根本原因

current 版本等于某个条目的 TargetVersion 时,Contains() 检查会返回 true(因为 MinSourceVersion <= current),导致重复选择同一个条目,<= current 条件缺失使得无法跳过已到达的版本。

修复方案

在选择 next 条目时添加 tv <= current 检查,确保目标版本严格大于当前版本:

if(!Version.TryParse(e.TargetVersion,outvartv)||tv>to||tv<=current)continue;

修复提交: 98bba22

受影响版本

  • VersionRange.GetUpdatePath(Version, Version, IEnumerable<UpdateCatalogEntry>)
  • VersionRange.GetUpdatePath(Version, Version, IEnumerable<UpdateManifest>)

测试验证

  • 52 个单元测试全部通过
  • Demo --check 命令正确显示更新路径:1.0.0 → 1.0.1 → 1.0.2 → 1.0.3 → 1.0.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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