Skip to content

fix(env): improve non-UTF-8 ACP fallback, GNU error wording, and env.md status (Fixes #1840) - #1843

Merged
caomengxuan666 merged 2 commits into
mainfrom
fix/1840-env-polish
Nov 22, 2026
Merged

caomengxuan666 merged 2 commits into
mainfrom
fix/1840-env-polish

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Fixes #1840.

Summary

  • Child-block byte handling: Added utf8_sequence_length, acp_bytes_to_wstring, and env_bytes_to_wstring in src/commands/env.cpp so valid UTF-8 runs pass through untouched while non-UTF-8 byte runs (e.g., X=\377 in .env files) are decoded via CP_ACP instead of collapsing directly to U+FFFD. (Arbitrary non-UTF-8 bytes still cannot round-trip through Windows' UTF-16 environment block; the byte-faithful env print path is unchanged.)
  • GNU message forms: Updated run_command and report_exec_error in src/commands/env.cpp so -C failures report env: cannot change directory to '<dir>': <reason> and missing/unexec commands report env: '<cmd>': <reason>. Added --argv0 without command usage error (rc 125).
  • Unit tests: Updated tests/unit/env/env_unit_test.cpp to assert the GNU message forms.
  • Docs: Updated DOCS/gnu-coreutils/env.md implementation status to reflect that -S/--split-string, -v/--debug, and -a/--argv0 (external programs) are implemented, with env: -a/--argv0 cannot dispatch any suite command (multicall argv0 conflict) #1839 tracking multicall -a dispatch.

Verification

  • Built test-env with MSVC (cmake --preset test) and ran env.*: 48/48 passed.

…md status (Fixes #1840)

Captain graft: re-assembled onto current main (7c225a9) after prerequisite
#1841 (canonical empty environment block) landed. Three-way merge of
env.cpp / env_unit_test.cpp / env.md was conflict-free; diff vs main is
byte-identical in stats to the original PR diff vs its base
(+130/-35, +13/-20, +1/-1). UNVERIFIED-BY-CAPTAIN pending fresh CI.
…aft bookkeeping for #1843)

The env polish in this PR adds three source strings whose zh-CN catalog
sync lands in a later translation batch:
command.env.error.chdir_failed, command.env.error.exec_failed,
command.env.error.shebang_hint. Per the drift gate's own rule, record
the growth in scripts/i18n-drift-baseline.json in the same PR via
scripts/check_i18n_drift.py --update-baseline: 192 items total,
zh-CN missing +3, no other drift change.

UNVERIFIED-BY-CAPTAIN pending fresh CI
@caomengxuan666
caomengxuan666 merged commit 3aaee81 into main Nov 22, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

env polish: child-block U+FFFD byte loss, message forms, stale env.md status

1 participant