Repository navigation
fix(env): canonical empty environment block for env -i launches (Refs #1837, #1838) - #1841
Merged
Merged
Conversation
caomengxuan666
force-pushed
the
fix/1837-env-empty-block
branch
from
November 22, 2026 16:01
cb9e1aa to
b37c162
Compare
caomengxuan666
marked this pull request as ready for review
November 22, 2026 16:38
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UNVERIFIED-BY-CAPTAIN — 队长车道交付,待复核。Refs #1837、#1838。
本 PR 做什么
src/commands/env.cpp的build_environment_block在无条目存活时(env -i无赋值、或只有空名赋值)只产出单个 NUL 的块——块格式的退化边缘。把它改为规范空块(终止符成对出现),条目数仍为零,非空路径逐字节不变。tests/unit/env/env_unit_test.cpp,+6):零条目块启动 printenv / hostname / od / winuxcmd 四个 env: env -i fails to launch some commands with an empty environment block (rc126) #1837 失败形态 + env/03 子进程半(env -i =x printenv)+ env: no env.exe in the installed link set — nested env broken once the shell builtin is gone #1838/env/70 的裸名嵌套 env 链(env -i Z=1 A=2 env→Z=1\nA=2\n)。钉把 applet 入口暂存到临时目录并置于 env 自身进程 PATH 上(块保持为空,命令解析走进程 PATH,与报告形态一致)。#1837 机理定位(源码侧)
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。#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 钉即该链的仓内回归面。未实机验证(重要)
env.*单测与差分 env 语料(02/03/48/70/71/72,期望 6/6)。本 PR 删除了什么