Skip to content

fix(env): canonical empty environment block for env -i launches (Refs #1837, #1838) - #1841

Merged
caomengxuan666 merged 1 commit into
mainfrom
fix/1837-env-empty-block
Nov 22, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
fix/1837-env-empty-block

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

UNVERIFIED-BY-CAPTAIN — 队长车道交付,待复核。Refs #1837、#1838。

本 PR 做什么

#1837 机理定位(源码侧)

  • 报错文本 "Invalid argument" 只可能来自 CreateProcessW 返回 ERROR_INVALID_PARAMETER:plan_child_launch 的失败状态经 child_status_to_win32_error 只能映射出 127/"No such file or directory"、"Permission denied"、"Not a directory",产不出 rc126 + 该文本。
  • 同一镜像在块中有一个条目(如 A=)时启动成功、空块时失败;两次调用之间唯一的启动路径差异就是 lpEnvironment 指向的块内容(解析路径、命令行、STARTUPINFO 均相同)。原块在空条目时退化为单个 WCHAR。
  • 本仓已有先例记载 CreateProcessW 对块内容做严格校验(同文件空名条目注释:整块以 ERROR_INVALID_PARAMETER 被拒)。

#1838 审计结论(不在本 PR 改代码)

已装 1.2.1 缺 env.exe 的根因(kFullOnlyCommandNames 误列 env)已由 #1627(2026-11-14)在 main 修复,v1.2.1(2026-11-02 定版)不含该修复。本车道复核了其余分发面:dispatcher 单一清单、wpm links、create_links.ps1 与 ISS(均委托 wpm)、arm64 分类表、release workflow 说明——未发现第二处排除 env 的清单。本 PR 的嵌套 env 钉即该链的仓内回归面。

未实机验证(重要)

  • 本车道尝试连接 X299 时 ssh 会话层无响应(与队长简报预警一致),未硬重试。因此:本 PR 未在 X299 构建、新增单测未在任何 Windows 环境实际跑过,差分语料 env 6 条亦未实跑。验收需在 X299 或 CI 上完成:构建后跑 env.* 单测与差分 env 语料(02/03/48/70/71/72,期望 6/6)。
  • 若新增钉在构建树上仍失败,则 env: env -i fails to launch some commands with an empty environment block (rc126) #1837 的机理不在块表示而在已装套件侧的镜像身份差异,需要队长在 X299 上对已装 usr/bin 做入口清单/硬链接核查后再定修法。

本 PR 删除了什么

  • 无删除。生产代码 +13 行(单个条件分支),测试 +123 行。

@caomengxuan666
caomengxuan666 force-pushed the fix/1837-env-empty-block branch from cb9e1aa to b37c162 Compare November 22, 2026 16:01
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 22, 2026 16:38
@caomengxuan666
caomengxuan666 merged commit c22af04 into main Nov 22, 2026
28 of 32 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 22, 2026
…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.
caomengxuan666 added a commit that referenced this pull request Nov 22, 2026
…md status (Fixes #1840) (#1843)

* fix(env): improve non-UTF-8 ACP fallback, GNU error wording, and env.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.

* chore(i18n): record drift growth for the three new env error keys (graft 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
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.

1 participant