Repository navigation
Fix #1621: un-register retired echo -r/--repeat so it prints as data - #1624
Conversation
The retired -r/--repeat extension was still declared INT_TYPE in ECHO_OPTIONS, so the dispatcher consumed and int-validated its value ahead of the handler: `echo -r x` and bare `echo -r` were rejected with rc 1 while GNU coreutils 9.4 prints them as data, rc 0. The long form was already data (echo allows no long options), so removing the registration makes every spelling reach the handler verbatim like every other non-[-neE] token. Sync the permissive-policy comment in command_context.cppm and add regression pins for the three spellings from the issue. Refs #1621
|
i18n-drift root cause fixed at the source: the un-registration removed |
The i18n-drift orphan-key fix landed on the catalog repo's main (#38); the PR-trigger workflow has no ready_for_review trigger, so this empty commit re-runs the check suite against the fixed catalog.
…historical snapshot (#1629) The checkpoint section records the acceptance state as audited by the lead review: current main had 50 commands wired (not the historical 76/42 numbers), A1/tail/ABI-v3 are not accepted yet, I18N is an acceptance prerequisite, and the safety record for preserve-root (chmod/chgrp/chown) blocks wiring until the listed gates pass. Captain addendum records same-day movement: #1627 merged, PRs #1624/#1625/#1626/#1628 open, and the fix/batch-1595-1616-1617 trio.
队长合入后复核 PASS — WinuxCmd#1624(Fixes #1621)已合入
i18n:源码里 无删除面异议:只删了一个已退役扩展选项及其注释,示例 |
Summary
Follow-up to #1620 (residual O2):
echo -r xand bareecho -rreturned rc 1 on the new exe, while GNU coreutils 9.4 prints them as data, rc 0.Root cause
ECHO_OPTIONSinsrc/commands/echo.cppstill declared the retired-r/--repeatextension asINT_TYPE. The generic dispatcher (src/core/opt.cppm) int-parses anINT_TYPEoption's value before the handler runs:echo -r xfailed the int parse (set_invalid_argument), bareecho -rhitset_missing_argument, both rc 1. The rust2 echo handler (rust2/crates/winux-cmds/src/echo.rs) is GNU-exact and would have printed the tokens as data.Correction to the issue text, verified by measurement on base: the long form was already data on base. Echo's policy sets
allow_long_options = false(command_context.cppm), so the long-option branch (opt.cppm:404) is skipped and--repeat xfalls through to positional. Only the two short spellings were actually rejected on base. The--repeat xpin guards the already-correct behavior.Fix
-r/--repeatfromECHO_OPTIONS(keep-u/--upperregistered: a Bool flag can never reject an argv; it only parses for occurrence bookkeeping).src/core/command_context.cppm.tests/unit/echo/echo_unit_test.cpp:-r x,-r,--repeat x→ data, rc 0.command.echo.option.repeat(verified withscripts/i18n_batch.py extract— present in the base extract, absent in the head extract); the zh-CN catalog sync is i18n(zh-CN): drop command.echo.option.repeat (WinuxCmd#1621) winuxcmd-i18n#37 (key removed +VERSION0.6.32 → 0.6.33).GNU anchors
builtins/echo.def(bash 5.3): echo has no-roption./usr/bin/echo:echo -r x→-r x,echo -r→-r,echo --repeat x→--repeat x, all rc 0.本 PR 删除了什么
src/commands/echo.cpp: the-r/--repeatentry (oneOPTION(...)line + its[EXT]comment line) fromECHO_OPTIONS. No other code removed.catalogs/zh-CN/catalog.json(winuxcmd-i18n, separate PR Merge develop into main #37): thecommand.echo.option.repeatkey (one line).echo --repeat 3 helloexample line is untouched (it demonstrates a data spelling, consistent with GNU output).Verification (X299 + CI, 2026-11-14)
UNVERIFIED-BY-CAPTAIN — legs run by the fix lane; captain review pending.
68d2917c(fresh X299 build,build-vs/usr/bin/echo.exe):echo -r x→ rc 1 (echo: invalid argument 'x' for '-r');echo -r→ rc 1 (echo: option requires an argument -- 'r');echo --repeat x→ rc 0, prints--repeat x.234aac52(fresh X299 build): all three spellings rc 0, output identical to GNU coreutils 9.4.winuxcmd-tests.exe --gtest_filter=echo.*): head 36/36, base 33/33 (the +3 are the new issue1621 pins).i18n-drift, which fails on exactlyzh-CN: new drift (extra): command.echo.option.repeat— cleared when i18n(zh-CN): drop command.echo.option.repeat (WinuxCmd#1621) winuxcmd-i18n#37 merges. ctest 3866/3866 passed, pins [upstream-closed] ls panics (unwrap None) on--time-style=posix-(empty after prefix strip) (uutils#12629) #819–821 passed./usr/bin/echoprints all three spellings as data, rc 0.