Skip to content

fix(mkfifo/mknod + chgrp/chown/chcon): fold POSIX drive-dialect operands before any Win32 call (#1235, #1241) - #1249

Merged
caomengxuan666 merged 4 commits into
mainfrom
fix/1235-1241-drive-dialect
Oct 19, 2026
Merged

caomengxuan666 merged 4 commits into
mainfrom
fix/1235-1241-drive-dialect

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Fix mkfifo/mknod + chgrp/chown/chcon POSIX drive-dialect misparse (#1235, #1241)

第二波路径方言修复(#1230 审计 15 命令;第一波 #1243 mkdir/ln、#1245 canonicalize 已合并)。

问题

Win32 把前导 /e 解析到当前驱动器。五个命令把用户原文直接交给 Win32:

修法(沿用 #1243/#1245 先例)

  • 参数消费点统一过共享边界 make_api_path_operand / normalize_api_operand(chown 的 CreateFileW 用 operand.extended,安全 API 用 operand.normalized;递归子项从显示拼写逐层重 fold,chmod -R 先例)。
  • 不在错误报告层打补丁:错误消息保用户原文拼写(display/折叠分离管道,fix(mkdir,ln): fold POSIX drive-dialect operands before any write (#1233, #1234) #1243 NIT 先例),新增 pin 断言消息里绝不出现 X:\ 折叠形。
  • preserve-root failsafe 里的全分隔符拼写(/)原样透传——normalize_api_operand 会把 / 经 shell-tree 映射到 shell 根,破坏卷根比较(回归捕获,已修)。
  • chown/chcon 的 glob:匹配时按折叠形枚举(等价 shell 展开);未匹配保原文,诊断仍引用用户拼写。

矩阵(PS/cmd 原生 argv;Git Bash 通道 MSYS 预转参数会假绿,#1230 教训;oracle=D:\Git\usr\bin 同名.exe + PowerShell 三方)

形 = {/e/...(dia)、/cygdrive/e/...(cyg)、/mnt/e/...(mnt)、裸根 /e(root)、Windows 形(win,控制组)} × cwd = {C:\Windows, D:}(E 盘自建 E:\probe-wa\,用后清)。

探针 形 main 基线(6e8ea19) 本 PR MSYS oracle
mkfifo /e/probe-wa/mf(cwd=C:) dia rc=1 ENOENT(探 C:\e\...) rc=0,落 E:\probe-wa rc=0 落 E:
同上(cwd=D:) dia rc=1 ENOENT rc=0,落 E:(影子 D:\e 全程 False) rc=0
mkfifo /cygdrive/e/... ×2 cwd cyg rc=1 ENOENT rc=0,落 E: (MSYS 只认 dia 形;cyg/mnt 是 WinuxCmd #1145/#1172 接受的方言)
mkfifo /mnt/e/... ×2 cwd mnt rc=1 ENOENT rc=0,落 E: 同上
mkfifo E:\probe-wa\mf ×2 cwd win rc=0 rc=0(不变) rc=0
mkfifo /e(裸盘符根) root C:: rc=1 Permission denied(试图建 C:\e);D:: rc=0 真建 D:\e 标记 rc=1 "File exists",无影子 rc=1 "File exists"(文本一致)
mknod <形> p(全表) 全 同 mkfifo 同构误析 全绿,同构修复 同
chgrp/chown -v --reference=<形g> <形g> dia/cyg/mnt/win rc=1 "failed to get attributes" rc=0 "… of '<原拼写>' retained" rc=0 retained(文本一致)
chgrp/chown --reference=<形nope> miss rc=1(文本已对齐) rc=1(不变,原拼写) rc=1 同文本
chgrp/chown -R -H --reference=<形目录> <形目录> 递归 failsafe 失守/误报缺失 rc=0,仅落操作数盘,无影子 —
chcon -v <形g> res rc=1 "cannot access"(误报缺失) rc=1 "<原拼写>: SELinux…not supported"(文件解析成功层) rc=1 file found 后报上下文不支持(解析层对齐)
chcon -v <形nope> miss rc=1 "cannot access" rc=1(不变) rc=1 同文本

chgrp/chown 本机无组变更权限:一律走 --reference retained 形或 rc/错误消息与 oracle 对齐判定解析层,不冒充成功(票面要求)。

影子见证与清理

  • 见证 C:\e、C:\d、D:\e 每步快照:基线跑出 D:\e=TRUE(7 字节 fifo 标记,即票面写偏实证),已脚本清除;PR 跑全程 False。
  • 收尾行 CLEAN|pr|probe dir removed=True|witnesses C:\e=False C:\d=False D:\e=False;探针产物自管自清。

测试

  • 新增回归 20 个(mkfifo 5、mknod 4、chgrp 4、chown 4、chcon 3):方言拼写从 TempDir 自身驱动器合成(任意主机可过)、cwd-on-other-drive 影子负断言、裸盘符根 no-op、cygdrive/mnt 前缀、消息原拼写 pin。
  • 五组 80/80 绿;全量 ctest 3000+ 见 CI。

红线自查

  • 主检出只读(仅 worktree D:/repo/winuxcmd-wt-wave2a 写入);无 stash;构建走 scripts/build.py(MSVC+CMake+vcpkg)。

@caomengxuan666

Copy link
Copy Markdown
Member Author

Independent code review — verdict: REQUEST-CHANGES (1 blocker; everything else verified green)

Reviewed independently from a fresh detached worktree at bf08199 (base 6e8ea19; 3 commits, 11 files — no piggyback, clang-format clean on all 10 C++ files). PR build + separate baseline (6e8ea19) build, PS native argv throughout, MSYS oracle from D:\Git\usr\bin at the same cwd/argv.

BLOCKER — preserve-root failsafe bypass via multi-slash spellings (//)

get_preserve_root_match (chown.cpp:584-591, chgrp.cpp:276-281) keeps all-separator operands verbatim for the volume-root comparison, while the operation side folds them through normalize_api_operand_w, where any all-/ spelling collapses to / and then maps through the shell tree (WINUXSH_ROOT). / itself is saved by the bypass (verified: chown -R --preserve-root <acct> / → "it is dangerous", no descent), but the rest of the family is not:

  • // and / name the same object — ls -id / // → identical inode (the WINUXSH_ROOT installation directory here).
  • MSYS oracle: chown -R --preserve-root Administrators // → it is dangerous to operate recursively on '//', rc 1. PR: no "dangerous" message — it performs the operation: chown -v --reference <f> // actually changed the shell-root directory's group (unelevated; observed and reverted), and with -R --preserve-root --reference <f> // under a redirected WINUXSH_ROOT the failsafe demonstrably does not fire (same "retained" + descent attempt as without the flag), while the identical row with / is rejected. Base (6e8ea19) behavior for // was a benign cannot access '//' — so this is a regression introduced by the change that was supposed to harden this exact failsafe.
  • Exploitability note: the reference/from-less form works unelevated on any cmx-owned shell root; damage is bounded by install-tree permissions, but the failsafe's whole job is refusing root spellings.

Suggested 2-line fix (in the function this PR already touched, chgrp + chown): when all_separators, return PreserveRootMatch{input_path, input_path != "/"} directly — every all-separator operand is a root spelling, no GetFullPathNameW needed. (Optionally mirror the guard in chgrp's process_file literal file == "/" check.)

Verified (all re-executed)

  1. Fold completeness — mkfifo/mknod: single consumption path (probe via operand_target_attributes_w, create via operand.normalized); block/char fails before any create; messages keep the typed spelling. Matrix: mkfifo /e/..., /cygdrive/e/..., /mnt/e/... from a D: cwd → rc 0, markers on E:, zero shadow; mknod /e p → rc 1 "File exists" (MSYS-identical).
  2. Fold completeness — chgrp/chown recursion: children rebuilt from the display spelling and re-folded per level in BOTH walks (chgrp process_directory, chown process_recursive); -R -v --reference over a 4-level tree lists every level with /e/... spelling, rc 0, no "cannot access" — verified for chgrp, chown, and chown via /cygdrive/e/ spelling. Idempotency of re-folding native forms confirmed at the boundary (is_drive_form requires a leading separator).
  3. Glob: patterns fold before glob_expand; with WINUX_SHELL_GLOB=native (matching tests/framework/pipeline.cpp) chown -v --reference /e/.../g /e/.../*.txt matches the E: file. Unmatched patterns stay literal by design.
  4. Baseline write-drift reproduced: base mknod /e p from a D: cwd → rc 0, real 7-byte fifo marker created at D:\e (recorded, removed); base dialect rows report "failed to get attributes"/"cannot access" from a C: cwd. PR rows: all green, DRIFTSUMMARY empty across clean-slate runs (witness sweep C:\e C:\d D:\e D:\d after every row).
  5. Messages: no API-form (X:\, \\?\) leak — no print call in the five commands touches operand.*/wpath; format_chown_error, retained/changed lines, and missing-reference errors all quote the display spelling.
  6. Tests: 20 new TEST cases in the diff, 80/80 pass across the five suites; full ctest 3019/3024, 5 failures — all 5 pass in isolation: the 2 shadow-negative dialect tests fail only while a foreign C:\e (a probe-cr1250 artifact from a concurrent session on this machine) exists (parked → both pass → restored byte-exact); cygpath/mktemp/xargs flakes reproduce the known jitter (mktemp flake also seen by the fix(native-path): fold the POSIX drive dialect in canonicalize_path_w (#1231) #1245 review).
  7. GNU alignment: --reference retained wording matches MSYS shape (retained as ...); chcon resolves then reports not-supported, rc 1 (MSYS: "failed to change context ... Not supported"); mkfifo/mknod existing-target wording matches.

Nits (non-blocking)

  1. Literal wildcard operand error text: unmatched /e/x/*.txt → cannot access ...: <invalid syntax> (ERROR_INVALID_NAME from the \\?\ probe) where GNU says ENOENT. Cosmetic; consider win32_posix_error_text mapping.
  2. Matched-glob diagnostics quote the folded native form (E:\probe-cr1249\h2.txt) rather than the typed spelling; unmatched stays verbatim. Cosmetic.
  3. Unit-test gap: the glob fold in add_file_args (chown/chcon) has no drive-dialect unit row; covered only by my matrix. Worth one case.
  4. Pre-existing, out of scope: --preserve-root defaults off (help text documents it; GNU defaults on) — the blocker above is worth fixing before this surfaces; chgrp's process_directory drops the recursive call's return value.
  5. Review-environment note: a concurrent session left C:\e\probe-cr1250\victim.txt on this machine; it polluted the two shadow-negative ctest tests and my first matrix run's witness sweep. Left in place (not mine to delete), worked around.

Fix the blocker and this is an approve; the dialect work itself (folds, re-fold closure, spelling preservation, tests, changelog) is exactly right.

caomengxuan666 added a commit that referenced this pull request Oct 19, 2026
…-root failsafe

The #1241 failsafe kept all-separator operands verbatim while the operand
layer collapses them onto '/' (ls -id / // reports one inode): a verbatim
GetFullPathNameW('//') answers for an UNC-ish name, so the volume-root
comparison missed and 'chown -R --preserve-root X //' really walked the
shell root, changing group ownership under WINUXSH_ROOT without the
privilege (CR on #1249; the base binary benignly answered
'cannot access //').

All-separator spellings now hit the root match directly, printing the
operand spelling alone (MSYS: "on '/'", "on '//'"; MSYS collapses '///'
in its own argv layer, ours prints it as received).  A spelling that
lexically collapses onto the root ('/e/..', '/tmp/..') fires with the
'(same as '/')' suffix MSYS prints for those; '//e/..' keeps the POSIX
two-slash rule and resolves against '//e' like MSYS ('cannot access').

Regressions pin //, ///, //e/.. and /e/.. across chgrp and chown
-R --preserve-root, plus the literal '/' rejection.
@caomengxuan666

Copy link
Copy Markdown
Member Author

BLOCKER 修复已推:新 head 24a7ef4(fix(chgrp,chown): reject all-separator root spellings in the preserve-root failsafe)。

修法

get_preserve_root_match(chgrp.cpp / chown.cpp 孪生):

  1. 全分隔符拼写(//、///)⇒ 直接命中根匹配——操作端把它们收缩到 /(ls -id / // 同 inode),而 verbatim GetFullPathNameW("//") 应答 UNC 形名字,导致卷根比较失守、真走 shell 根。命中后按 MSYS 文案打印操作数原拼写、无后缀(oracle:it is dangerous to operate recursively on '//')。
  2. 词法收缩形(/e/..、/tmp/..)⇒ 根匹配带 (same as '/') 后缀(oracle 实证文案,与 MSYS 逐字对齐;纯词法判定,不依赖驱动器存在)。
  3. //e/.. 保 POSIX 双斜杠规则——根在 //e 不在 /(MSYS 同样报 cannot access),拒于访问解析层,无根匹配、无下降。

CR repro 复测(非提权,PR head 二进制)

操作数 修复前(bf08199) 修复后(24a7ef4) MSYS oracle
chown -R --preserve-root X // 真走 shell 根改组 rc=1 it is dangerous ... '//' + failsafe 行 rc=1 同文案
chgrp -R --preserve-root X // 同上 rc=1 同上 —
/// ×2 绕过 rc=1 ... '///' rc=1(MSYS argv 层收缩显示 /)
//e/.. ×2 cannot access(良性) rc=1 cannot access(不变) rc=1 同文案
/e/.. ×2 — rc=1 ... '/e/..' (same as '/') rc=1 同文案含后缀
/(正拒不回退) rc=1 rc=1(既有快照不变) rc=1 同

补齐

  • 回归 +6(chgrp/chown 镜像:all-separator //+///、double-slash component //e/..、dotdot collapse /e/..);/ 拒绝由既有快照测试继续钉住。五组合计 86/86 绿。
  • 全量 ctest 3030 测:失败 13 个为第 4 轮不相交随机集(0xc0000409 fail-fast 为主,与本改动命令无涉),逐个复跑 13/13 全绿——同一负载抖动模式;CI 干净机器为权威门槛。
  • 矩阵探针复跑(tag pr2):mkfifo/mknod 全形落 E:、裸根拒绝、CLEAN|pr2|probe dir removed=True|shadow leaves C:\e\probe-wa=False C:\d\probe-wa=False D:\e\probe-wa=False。见证改用自带子目录叶子,未触碰 C:\e\probe-cr1250(复核时该现场已被 shred CR 会话自行清理,本会话全程只读)。

…ion (#1235)

mkfifo/mknod handed the raw operand ('/e/n', '/cygdrive/e/n', '/mnt/e/n')
to the existence probe and create_winux_fifo_w, and Win32 resolves a
leading '/e' against the CURRENT drive: from a C: cwd 'mkfifo /e/n'
probed '<cwd>:\e\n' and reported ENOENT for a real E:\n, and 'mkfifo /e'
from a D: cwd really wrote the fifo marker to D:\e (probe-verified).

Operands now fold once through the shared make_api_path_operand
boundary before any filesystem call; bare '/e' reports 'File exists'
like MSYS instead of touching '<cwd>:\e', and messages keep printing
the operand spelling as typed.

Regressions synthesize the dialect spelling from the TempDir's own
drive (land-on-operand-drive, cwd-on-other-drive shadow negatives,
bare-drive root, cygdrive/mnt prefixes, message-spelling pin) and pass
on any host.
…Win32 call (#1241)

The chown/chgrp family resolved '--reference' and target file operands
raw: an unfolded '/e/...' spelling makes GetFileAttributesW /
GetNamedSecurityInfoW / the WRITE_OWNER open / FindFirstFileW answer
for '<cwd>:\e\...', so existing E: files were reported as missing from
any other cwd, and 'chgrp/chown -R --preserve-root /e' missed the
failsafe (the volume-root comparison saw '<cwd>:\e') and descended
into the shadow tree. chown/chcon globs enumerated the wrong drive.

Security lookups, attribute probes, the recursive walks and the glob
pattern now fold through the shared boundary first; recursive children
re-fold from their display spelling (chmod -R precedent) and error
text keeps the user's spelling. An all-separator operand ('/') stays
verbatim in the preserve-root failsafe: normalize_api_operand resolves
it through the shell tree, and that native root is not the volume root
the failsafe has to match (regression-caught).

Regressions use the --reference retained form as the parse-layer probe
(no security state is modified, per the ticket's no-fake-success rule)
with cwd-on-other-drive, recursive-walk, missing-file spelling pins and
chcon resolve-then-report-unsupported shapes.
…-root failsafe

The #1241 failsafe kept all-separator operands verbatim while the operand
layer collapses them onto '/' (ls -id / // reports one inode): a verbatim
GetFullPathNameW('//') answers for an UNC-ish name, so the volume-root
comparison missed and 'chown -R --preserve-root X //' really walked the
shell root, changing group ownership under WINUXSH_ROOT without the
privilege (CR on #1249; the base binary benignly answered
'cannot access //').

All-separator spellings now hit the root match directly, printing the
operand spelling alone (MSYS: "on '/'", "on '//'"; MSYS collapses '///'
in its own argv layer, ours prints it as received).  A spelling that
lexically collapses onto the root ('/e/..', '/tmp/..') fires with the
'(same as '/')' suffix MSYS prints for those; '//e/..' keeps the POSIX
two-slash rule and resolves against '//e' like MSYS ('cannot access').

Regressions pin //, ///, //e/.. and /e/.. across chgrp and chown
-R --preserve-root, plus the literal '/' rejection.
@caomengxuan666
caomengxuan666 force-pushed the fix/1235-1241-drive-dialect branch from 24a7ef4 to fd1ea28 Compare October 19, 2026 09:20
@caomengxuan666

Copy link
Copy Markdown
Member Author

rebase 到 v1.1.17 main(a6e4990,解 CHANGELOG Unreleased/1.1.17 冲突,shred #1240 条目保留),最终 head fd1ea28(源文件与 24a7ef4 逐字节相同:git diff 24a7ef4 HEAD -- src/commands/{chgrp,chown,mkfifo,mknod,chcon}.cpp tests/unit/{chgrp,chown,mkfifo,mknod,chcon} 为空)。CI 于 fd1ea28 全绿(x64 17m29s / arm64 2m14s / oracle / compare pass)。rebased 二进制复证:chown/chgrp -R --preserve-root X // → rc=1 "it is dangerous ... '//'";矩阵 pr3 CLEAN|pr3|probe dir removed=True|shadow leaves C:\e\probe-wa=False C:\d\probe-wa=False D:\e\probe-wa=False。本地全量 ctest 3063 测仅 2 个已知抖动类失败(lsof 超时、mktemp cygdrive),复跑 2/2 绿,本组命令零失败。

@caomengxuan666

Copy link
Copy Markdown
Member Author

Independent code review — BLOCKER-fix round — verdict: APPROVE-WITH-NITS

Original REQUEST-CHANGES blocker (chown/chgrp -R --preserve-root X // bypassing the failsafe via the all-separator spelling) is CLOSED and re-verified end to end on the rebased stack (head fd1ea28 = 4 commits on current main a6e4990, MERGEABLE). Reviewed from a fresh detached worktree (D:/repo/winuxcmd-cr-1249b, since removed); PR build + baseline build + pre-fix build, PS native argv throughout, MSYS oracle (D:\Git\usr\bin), all potentially-walking rows under a throwaway WINUXSH_ROOT fakeroot with a C:\e/C:\d/D:\e/D:\d witness sweep after every row — DRIFTSUMMARY CLEAN, zero shadow writes.

BLOCKER closure — reproduced, then verified fixed

Three-point chain, all self-run on this rebase:

  1. Base (a6e4990): chown -R --preserve-root -v Users // (and --reference form) under redirected WINUXSH_ROOT → benign cannot access '//' (ERROR_INVALID_NAME), no failsafe fire, no walk. / control refuses. (So the real-execution bug is not on main; it is introduced by this PR's own chgrp/chown/chcon 裸盘符根 /x 形态裸 GetFullPathNameW 误解析——同构三连(含 --reference 实参) #1241 fold commit and fixed by fd1ea28.)
  2. Pre-fix PR head (ff5db14 = fd1ea28^): failsafe misses, operation side really resolves // onto the shell root — chown -R --preserve-root -v --reference <f> // → ownership of '//' retained as cmx:None (that is the fakeroot's own group, i.e. // named the WINUXSH_ROOT directory) and Users // → cannot access '//': Operation not permitted — a real WRITE_OWNER attempt on the shell root with --preserve-root set, no "dangerous" message. BLOCKER reproduced exactly as reported last round.
  3. Fixed head (fd1ea28): chown/chgrp -R --preserve-root X // → it is dangerous to operate recursively on '//' + use --no-preserve-root to override this failsafe, rc 1, no access, no suffix — verbatim MSYS oracle match (ORA: chown: it is dangerous to operate recursively on '//', rc 1). Also ///, ////, \, /\, \/, \/\/ all direct-hit refused.

Fix audit (three segments, oracle-verified)

  1. All-separator spellings (//, ///, mixed /\ \/ \/\/, bare \): direct root match, message quotes the spelling as typed, no suffix. Oracle: '//' → no suffix, exact match. '///' → MSYS collapses to '/' in its own argv layer, ours prints '///' — the one documented divergence (commit message and CHANGELOG both say so; safe direction — refusal identical). ls -id / // → same inode on the PR build (premise confirmed).
  2. Lexical contractions: /e/.., /tmp/.., /e/../.., /., /./, /.., /./e/.., /e/../., /e/..//, ///e/.., ////e/.., \e/.. → refused with (same as '/'). Oracle empirically prints (same as '/') for every one of these (including ///e/.. with the spelling quoted as typed — ours matches exactly). Suffix rule cross-checked against GNU 9.11 root-dev-ino.c (ROOT_DEV_INO_WARN: bare "/" → no suffix, else (same as '/')).
  3. //e/.. POSIX two-slash rule: no root match, no descent — cannot access '//e/..' (chown: Win32 invalid-name text; chgrp: ENOENT; MSYS: ENOENT). //e, //tmp/.., // (trailing space), /\e/.., \/e/.. likewise cannot-access, zero shadow. collapses_onto_root opts out for exactly-two-leading-separators-with-a-component, which is what keeps //e/.. off the direct-hit path.

Bypass hunt: 17 adversarial spellings + multi-operand row (/e/.. // ///e/.. in one invocation → all three refused) — none escapes. Negative control (--no-preserve-root //) proves the walk would reach the redirected shell root when the flag is off, so the refusals above are meaningful; witness sweep stayed clean through all rows.

Rebase integrity, regressions, hygiene

  • No lost content: tree at old reviewed head bf08199 vs rebased pre-fix head ff5db14 differs only by Wave2 files merged through the new base (date/ldd/look/namei/shred/tree/wpm + CHANGELOG 1.1.17 section) — this PR's 5 source files and 5 test files are byte-identical; the 4th commit (fd1ea28) is the only new content (fix + 6 tests + CHANGELOG amendment, which rewrites the now-stale "stays verbatim" sentence). 11 changed files total, no piggyback.
  • Tests: 86/86 across the five touched suites (mkfifo 12, mknod 10, chgrp 23, chown 32, chcon 9 = previous 80 + new 6, self-run). Full ctest 3063/3063 passed, 0 failed (self-run; last round's 5 environmental flakes included — the foreign C:\e artifact is gone and the shadow-negative dialect tests now pass in the full run). clang-format --dry-run --Werror clean on all 10 C++ files. Process-whitelist check around the full run: no unexpected process kills (only my builds' own mspdbsrv exiting on idle; a foreign cargo from a concurrent session finished on its own).
  • Previously-verified matrix spot rows on the rebased tree (5): mkfifo /e/... from D: cwd → created on E:; mknod /e p → File exists (MSYS-identical), no D:\e; chgrp -R -v --reference /e/.../deep and chown -R ... → all 8 levels listed with /e/... display spelling, rc 0; chown glob → matches the E: file. chcon resolve-then-unsupported rc 1 unchanged.

Nits (non-blocking)

  1. . at the shell root still walks: chown -R --preserve-root X . with cwd = WINUXSH_ROOT root → rc 0, "ownership of '.' retained" (i.e. the recursive walk ran on the shell root). GNU's dev+ino check refuses any operand naming /, including .. Pre-existing on the base (volume-root comparison by design, relative operands never enter the failsafe), different operand class from the spellings this PR fixes — worth a follow-up issue, not a merge blocker.
  2. chown vs chgrp vs MSYS error text for //e/..: chown prints the Win32 invalid-name text where chgrp and MSYS print No such file or directory. Cosmetic; same mapping nit as last round's refactor(cmd): restructure command modules and update documentation #1.
  3. /// display divergence is documented (ours ///, MSYS /) — accepted as stated in the commit message; flagging it here only so it is on the record as intentional.
  4. Pre-existing, unchanged, previously flagged: chgrp process_directory drops the recursive call's and the directory's own change_group return values.

Merge is safe from my side: the blocker that caused REQUEST-CHANGES is fixed with oracle-aligned texts, regression-pinned for both commands, and nothing else in the 4-commit stack moved.

@caomengxuan666
caomengxuan666 merged commit 23f37f5 into main Oct 19, 2026
8 checks passed
caomengxuan666 pushed a commit that referenced this pull request Oct 20, 2026
…grp failures (#1262)

Three non-blocking items from the #1249 CR sweep:

- 'chown Users //e/..' printed the Win32 path-syntax text where chgrp and
  the MSYS oracle print ENOENT: POSIX keeps "//e/.." rooted at '//e' (the
  two-slash rule), and Win32 rejects the UNC-ish folded name with
  ERROR_BAD_PATHNAME / ERROR_INVALID_NAME. Both now map onto
  'No such file or directory' in format_chown_error (chmod's
  format_access_error precedent), so all three print
  "cannot access '//e/..': No such file or directory".

- chgrp's process_directory dropped a directory child's change_group
  result and the recursive call's return, so a failing descendant still
  exited 0; both now fold into success like chown's process_recursive.

- The '///' display convention is now documented in
  DOCS/gnu-coreutils/{chgrp,chown}.md: diagnostics quote the operand as
  typed, so '///' prints verbatim where MSYS shows '/' after its own
  argv-layer collapse - same refusal, display-only divergence.

Tests: pin the ENOENT reason text in both commands' //e/.. refusal rows
and add chgrp_recursive_descendant_failure_reaches_exit_code, which
makes a descendant's named security call fail deterministically via a
DENY GENERIC_ALL self-ACE (no privileges needed) and asserts rc 1 plus
the per-descendant diagnostics.

87/87 across the chgrp/chown/mkfifo/mknod/chcon suites; no i18n catalog
delta (no extracted literal changed).
caomengxuan666 added a commit that referenced this pull request Oct 20, 2026
…grp failures (#1262) (#1268)

Three non-blocking items from the #1249 CR sweep:

- 'chown Users //e/..' printed the Win32 path-syntax text where chgrp and
  the MSYS oracle print ENOENT: POSIX keeps "//e/.." rooted at '//e' (the
  two-slash rule), and Win32 rejects the UNC-ish folded name with
  ERROR_BAD_PATHNAME / ERROR_INVALID_NAME. Both now map onto
  'No such file or directory' in format_chown_error (chmod's
  format_access_error precedent), so all three print
  "cannot access '//e/..': No such file or directory".

- chgrp's process_directory dropped a directory child's change_group
  result and the recursive call's return, so a failing descendant still
  exited 0; both now fold into success like chown's process_recursive.

- The '///' display convention is now documented in
  DOCS/gnu-coreutils/{chgrp,chown}.md: diagnostics quote the operand as
  typed, so '///' prints verbatim where MSYS shows '/' after its own
  argv-layer collapse - same refusal, display-only divergence.

Tests: pin the ENOENT reason text in both commands' //e/.. refusal rows
and add chgrp_recursive_descendant_failure_reaches_exit_code, which
makes a descendant's named security call fail deterministically via a
DENY GENERIC_ALL self-ACE (no privileges needed) and asserts rc 1 plus
the per-descendant diagnostics.

87/87 across the chgrp/chown/mkfifo/mknod/chcon suites; no i18n catalog
delta (no extracted literal changed).

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 deleted the fix/1235-1241-drive-dialect branch October 21, 2026 08:17
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