Skip to content

[ls] 非法 --sort 值退出码 2 且候选表含 name/type(GNU rc=1,候选表不同) #1645

Closed

Description

@caomengxuan666

现象

ls --sort=bogus:GNU 9.4 的 argmatch 失败 rc=1,候选表 none/time/size/extension/version/width;WinuxCmd rc=2,额外列出 name、type,顺序也不同。

  • WinuxCmd:WinuxCmd 1.2.1(基线 b781ff3,Release 构建)

  • GNU oracle:coreutils 9.4(WSL2),LC_ALL=C、TZ=UTC

  • 契约锚点:DOCS/oracle-audit/ls.md 行 L55

复现

& "...\ls.exe" --sort=bogus 2>&1 ; "rc=$LASTEXITCODE"

GNU 9.4(expected):ls: invalid argument 'bogus' for '--sort' + 6 项候选 + Try 'ls --help' ...,rc=1。

WinuxCmd 1.2.1(actual):rc=2,候选 8 项(name/size/time/version/extension/type/width/none)。

影响

依赖退出码区分用法错误(1)与解析错误(2)的封装层会误判。

Activity

  1. added
    compat-gap
    on Nov 14, 2026
  2. caomengxuan666 commented on Nov 14, 2026

    @caomengxuan666
    MemberAuthor

    intake 定序:ls 面同文件串行——本单待 #1639 合入后派修(队长队列,先派 #1639)。

  3. caomengxuan666 commented on Nov 14, 2026

    @caomengxuan666
    MemberAuthor

    本会话按队长授权接管 ls 家族 lane,在 fix/ls-1643-1646 上续作(工作树 D:/repo/wc-lsfix,基线 8be156e)。

    已修:非法/歧义 --sort 值 rc=1,候选表与 9.4 一致(none/time/size/extension/version/width;去掉本移植自造的 name/type,空值按 ambiguous);校验提前到选项解析阶段(ls.c:2138 XARGMATCH),因此单文件操作数或后置 -U 都无法绕过。

    字节对照:修复前 rc=2 且候选 8 项(name…none),单文件操作数时 rc=0 静默通过;修复后 rc=1,候选 6 项且顺序同 GNU,ls --sort=bogus file 同样 rc=1 且不输出列表。新增 2 个测试(候选表 + 空前缀/唯一前缀、单文件/后置 -U 仍拒绝)。未提交。

  4. added a commit that references this issue on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

compat-gap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions