Skip to content

fix(executor): #850 — fold /cygdrive/<letter>/... to the drive letter for in-shell faces - #893

Merged
caomengxuan666 merged 1 commit into
masterfrom
arookieofc/fix-850-cygdrive-fold
Oct 20, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
arookieofc/fix-850-cygdrive-fold

Conversation

@arookieofc

Copy link
Copy Markdown
Member

Closes #850.

shell_path_to_windows had a /mnt folding arm but no /cygdrive arm — so the in-shell faces (cd, test -f, [[ -d ]], source, redirect targets) ENOENT'd a path that the bundled winuxcmd applets (ls/cat/cp — normalize_api_operand_w already folds /cygdrive/d/... → /d/...) resolved fine. Same path, two answers by layer.

Added a /cygdrive/<letter> arm parallel to /mnt: exactly /cygdrive/X or /cygdrive/X/... maps to X:\ (or its subdirectory); every other /cygdrive* spelling falls through unchanged. Verified the five in-shell faces (cd, test -d, [[ -d ]], test -f, redirect write+read) all resolve a scratch dir through the fold, plus bare cd /cygdrive/d and the sibling /mnt//d forms unchanged.

Regression cygdrive_forms_resolve_across_in_shell_faces pins all five faces on one scratch dir; path-contract suites (native_core, posix_forms, verbatim) + issue566 stay green.

… for the in-shell faces

rubash's in-shell normalization (shell_path_to_windows) had a /mnt arm
but no /cygdrive arm, so `cd /cygdrive/d/repo`, `test -f`, `[[ -d ]]`,
`source`, and redirect targets all returned ENOENT for a path the bundled
winuxcmd applets (ls/cat/cp — whose normalize_api_operand_w already folds
/cygdrive/d/... into /d/...) resolved fine. Same path, two answers
depending on which layer handled it.

Add a /cygdrive/ branch parallel to the /mnt/ one: exactly
/cygdrive/<letter> or /cygdrive/<letter>/... maps to <letter>:\ (or the
drive's subdirectory). All other /cygdrive* spellings fall through to the
shell-root resolution, same as before.

Regression: cygdrive_forms_resolve_across_in_shell_faces exercises cd,
test -d, [[ -d ]], redirect write, and test -f+cat on one scratch dir.
Existing path-contract tests (native_core, posix_forms, verbatim) and
issue566 (bare drive root) stay green.
@github-actions

Copy link
Copy Markdown
Contributor

欢迎!这是你的第一个 PR 🎉 请确认已跑过本地测试套件;CI 通过后维护者会 review。

@caomengxuan666

Copy link
Copy Markdown
Member

独立评审结论:APPROVE-WITH-NITS

(评审代理独立复验:自建克隆 + worktree 6e35230b,对照 master 基线二进制;rubash 探针经 PowerShell ProcessStartInfo 原生 argv + CREATE_NO_WINDOW 批量执行;交叉层对照 WinuxCmd#1245(已合并)fold_drive_dialect_w 语义;自建 scratch 目录(内含 AUD_MARK=srcmark 标记脚本),无 D:\ 依赖,落盘经 PS Test-Path + 内容双见证。)

复现与修复对照(master 红 → 分支绿,同一条 /cygdrive/c/... 路径)

面 master 本 PR
test -d / cd ENOENT 红(exit 10) ✅
[[ -d ]] / echo w > probe.txt / test -f+cat 同红(内建 cat 走 shell 归一化,master 也 ENOENT) ✅ 全通,落盘见证 True
. mark.sh(source,issue 点名面) 红 ✅(AUD_MARK 注入成功)
负例:/cygdrive(无尾段)、/cygdrive/、/cygdrive/cfoo、/cygdrivex、/cygdrive/1、/cygdrive/cc、/mntcc、/mnt/cfoo 不折叠 ✅ 全部维持不折叠;正控 /cygdrive/c/Users 折叠
裸盘根 cd /cygdrive/c ENOENT 红 ✅,pwd -P=/c/,与 /c、/mnt/c 三形全等
大写 /cygdrive/C、尾斜杠 /cygdrive/c/ — ✅
applet 面交叉一致性:ls /cygdrive/c/... vs ls /c/... — ✅ 输出逐字节一致

新守卫与 #1245 语义逐字对齐(恰 /cygdrive/X 或 /cygdrive/X/...;多字母首段 /usr//tmp//mntcc 类永不驱动),结构与既有 /mnt 臂同构(bytes[10]/[11] ASCII 边界与 normalized[12..] 切片安全),盘符大写化与 /c、/mnt 臂及 #1245 矩阵输出一致。

回归与审计

  • 家族:path_contract_boundary_posix_forms(含新回归)、native_core、issue566 全绿;verbatim 的 git_rev_specs 失败为本机环境性(装机缺 winuxcmd 下 git.exe,master 同红),非本票引入;issue566 文件内 unused import 警告为 master 既有(非本 PR 触碰文件)。
  • 全量 cargo test --no-fail-fast 失败集与 master 逐名 diff:唯一 delta fixture_text_tree_matches_normalized_output 在 master 隔离单跑同样间歇红(双方各复现一次)——pre-existing 时序 flake,非本票引入。CI 8/8 绿互证。
  • rustfmt --check 两处改动文件干净;越界审计:仅两声明文件,third_party/、LICENSE、Cargo.* 零触碰;GPL 干净。

NIT(不阻塞)

  1. 回归测试缺 source 面断言:issue rubash 内建面(cd/test -f/[[ -d ]]/source/重定向)不认 /cygdrive/d/* 方言——同一路径 winuxcmd applet 面可用,跨层方言集不一致 #850 验收清单点名 source(实测是好的,见上表),但 cygdrive_forms_resolve_across_in_shell_faces 没 pin 它——补一行 . '<cyg>/mark.sh' + 变量断言即可防回退。git -C 按 issue 自注属另票,不折进本票。
  2. (记录)/cygdrive/c/../x 折成 C:\..\x——与既有 /c、/mnt 臂行为同构,非本票新增的不一致。
  3. (记录,WinuxCmd 侧)realpath /cygdrive/c/... 仍 ENOENT——[bug] ulimit missing 9 resources: -R -e -i -l -m -q -r -v -x (GNU queries fine) #1245 明文列出的 canonicalize_path_w 相邻缺口(applet 侧职责,master 即如此),按仓库规则归 WinuxCmd 票,不折进本评审。

不合并(按评审纪律由维护侧执行)。

@caomengxuan666
caomengxuan666 merged commit 3de62e0 into master Oct 20, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the arookieofc/fix-850-cygdrive-fold branch October 21, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants