Skip to content

[test] chown from_filter assumes Administrators never owns the file #1608

Closed

Description

@caomengxuan666

现象

rust-tests job(PR #1605)572/5 中的 1 个:

chown::tests::from_filter,panic 于 rust2/crates/winux-cmds/src/chown.rs:1048:9:assertion failed: out.is_empty()

X299 复现同形。

根因(钉子,非产品)

测试(chown.rs:1035–1052)认为 -v --from Administrators 1234 f 应静默跳过(rc 0、stdout 空)——GNU 在 --from 不匹配时不打印。但在提权 token 的机器上,文件属主 SID 就是 Administrators 组:X299 实测文件 OWNER=BUILTIN\\Administrators,chown -v --from Administrators 1234 <file> 原样输出 ownership of '...' retained as 1234。产品正确匹配并打印,GNU 同样会打印;测试把 "Administrators 永不匹配" 写死为环境无关假设,在属主为 Administrators 的机器上自相矛盾(GH runner 与 X299 皆然)。产品侧已确认:resolve_part("Administrators") → Administrators 组 SID,sids_equal 字节比对,--from 不匹配路径在 describe 前静默返回(~chown.rs:640)。

修法

钉子加固:选一个必非属主的账号作 --from,或当文件属主解析为 Administrators 时条件断言/跳过。无产品改动。

来源

PR #1605 复核(Refs #1604):CI 572/5 + X299 第二路径复现 + 产品原样输出实测。

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

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions