Skip to content

fix(cp)+test: resolve dir-symlink deref chain; re-pin 4 stale pins (Fixes #1761) - #1766

Merged
caomengxuan666 merged 5 commits into
mainfrom
test/repin-1761
Nov 15, 2026
Merged

caomengxuan666 merged 5 commits into
mainfrom
test/repin-1761

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

The #1761 ten-test family adjudicates two ways (R1 report: devin-out-R1.md), every case settled by a GNU oracle probe first:

Real cp bugs — 6 tests KEEP, rust2 fixed. Win32 reports directory symlinks with the FILE attribute flag, so cp -H/-L never resolved them. cp/winfs.rs gains resolve_dereference_chain/expand_for_follow (mirroring the retired C++ dereferenced_source_path); cp/copy.rs consumes it; lstat/no-deref paths untouched.

Stale pins — 4 tests RE-PINNED to GNU/rust2 contracts, each with its probe: mktemp's no-tilde assertion pinned the retired GetLongPathNameW 8.3 expansion; find.issue_1617 pinned the retired C++ banner (rust2 emits GNU findutils bytes, oracle-identical); dir pinned the un-escaped path shape (rust2/ls -b emits GNU's escaping).

Verification: targeted 88/88; full ctest 4021/4041 (20 remaining are the pre-existing env class, each with its own stored failure file). Native-symlink cases skip locally — the privileged CI runner is authoritative for those.

Fixes #1761.

…le pins to GNU/rust2 contracts (Fixes #1761)

The #1761 family splits two ways on adjudication:

REAL cp bugs (6 tests KEEP, rust2 fixed): Win32 reports directory
symlinks with the FILE attribute flag, so cp -H/-L never resolved
them — cp/winfs.rs gains resolve_deref_chain/expand_for_follow
(mirroring the retired C++ dereferenced_source_path), cp/copy.rs
consumes it. lstat/no-deref paths untouched.

STALE pins (4 tests RE-PINNED, each with its WSL GNU oracle probe):
- mktemp x2: the no-tilde assertion pinned the retired C++
  GetLongPathNameW 8.3 expansion (RUNNER~1 -> runneradmin); rust2
  emits the template verbatim and a tilde in the directory segment
  is legal.
- find.issue_1617: pinned the retired C++ product banner; rust2
  emits the GNU findutils banner (oracle byte-identical).
- dir: pinned the un-escaped path shape; rust2/ls -b emits GNU's
  'test\ data' escaping.

Verification: targeted ctest 88/88; full ctest 4021/4041 (20
remaining = 4 stream-driver-not-built + 16 pre-existing env
shell_root/nul_txt/nice items, each with its own stored failure
file). Native-symlink cases SKIP locally (no
SeCreateSymbolicLinkPrivilege); junction/LX proxies verified — the
privileged CI runner is authoritative.
…s as #1721)

The fs-dirs/digest shards died in their GNU preflight: the workflow's
own wsl.exe --exec /bin/bash call runs under Git Bash, which rewrites
the leading-slash argv into Windows-native paths before the spawn —
run-gate.sh's internal guard (#1721) does not cover this step because
the preflight is invoked from the workflow directly. env-level
MSYS_NO_PATHCONV/MSYS2_ARG_CONV_EXCL on the step; YAML safe_load
validated.
…ps uutils coreutils

The gate-shard GNU preflight (doing exactly its job) refused the
oracle: the rolling 'Ubuntu' distro now defaults to uutils coreutils
— 'ls (uutils coreutils) 0.8.0' on the runner — so every shard would
have scored rust2 against the wrong oracle. Pin Ubuntu-24.04 to match
the attestation box (GNU coreutils 9.4 / C.UTF-8) and set it as the
default distro so run-gate.sh's bare wsl.exe calls land on it.
…he Git Bash circular mapping

Under a Git Bash parent, TEMP/TMP arrive in the MSYS form '/tmp'
itself. tmp_base() trusted the value verbatim, so /tmp resolved to
/tmp and every temp-file command failed (the CI gate's mk16-p-dir
row: rust2 rc 1 vs GNU rc 0, on a runner where GNU's /tmp is real).

tmp_base now skips candidates that cannot name a Windows directory
(leading '/'), keeping niubash#94's TMPDIR > TEMP > TMP priority and
falling through to the next candidate; when every candidate is
POSIX-spelled the caller's no-tmpdir path applies, as before.

Verified: driver with TEMP=/tmp TMP=/tmp creates in
%LOCALAPPDATA%/Temp and exits 0 (was rc 1); winux-core 31/0.
…-spelled

The CI gate-shard env is exactly TMPDIR unset + TEMP/TMP=/tmp (Git
Bash parent): the priority skip left tmp_base at None, the caller's
? propagated it, and mk16-p-dir still failed. niubash#94's intent is
a usable per-user temporary namespace — when no env candidate names
a Windows directory, query GetTempPathW (which itself skips
candidates that do not exist, landing on USERPROFILE\Temp under a
Git Bash parent). Purity note documented in tmp_base: this
last-resort arm reads process state, on purpose.

tmp_maps_through_tmpdir_temp_tmp's tail re-pinned to the new
contract (fallback names a Windows path, never a POSIX spelling).

Verified: env -u TMPDIR TEMP=/tmp TMP=/tmp driver mktemp -p /tmp
creates in %LOCALAPPDATA%/Temp rc 0; winux-core 31/1-fail -> green
after the re-pin; cargo fmt normalized ln.rs drift brought by the
rebase.
@caomengxuan666
caomengxuan666 merged commit 47fcf45 into main Nov 15, 2026
20 of 28 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 15, 2026
… fixture prefixes (#1767)

Third family of the #1767 first-honest-scoring sweep (G2 report:
devin-out-G2.md). All three verdicts are runner/oracle environment
rows — zero rust2 code changes:

- nice/nc01-bare strict->exit: the stdout IS the machine-bound
  niceness. GH runners start worker processes BelowNormal
  (actions/runner-images#7663), so both Windows sides print 10 while
  the WSL oracle prints 0 — rust==cpp, both != gnu, exactly the
  ledger signature. exit keeps the GNU rc anchor (rc is always 0);
  precedent mk19/sl20/sy01.
- hostid/ho17-flagish-operand exit->win: g_rc=124 is the timeout(1)
  kill — a fresh CI WSL lacks /etc/hostid, gethostid() falls to name
  resolution and stalls past 10s (ho01-plain 124 proves it is not
  the -- spelling). win = rust-vs-cpp rc parity on the platform-bound
  machine-id output; precedent wa04/gr02. The workflow also pre-seeds
  /etc/hostid non-fatally (printf 4 bytes -> GNU prints 21483247,
  verified end-to-end locally) — an oracle-honesty fix in the same
  class as the #1766 distro pin and #1729 locale pin.
- posix shard never ran: the workflow filtered --posix-mode out of
  progs, leaving preflight 'no command names given' exit 2 and no
  ledger. Preflight now takes the program set from cases-posix/*.tsv;
  run-gate.sh pre-creates the three GNU sandbox prefix mirrors,
  clearing chp01/mkp01 pendings. Local shard run 30/30 (4 strict +
  26 posix-ok, 0 pending).

Verified: run-gate.sh nice hostid -> GNU-gated 31 pass / 0 fail (the
2 local win-row fails are the local CPP_BIN's own 127 artifact, not
present in the CI runtime package); YAML safe_load OK.
caomengxuan666 added a commit that referenced this pull request Nov 15, 2026
…visible to the rust EEXIST check (#1767) (#1774)

* fix(gate): mn03 fixture becomes a plain file — MSYS fifo emulation is invisible to the rust EEXIST check (#1767)

GNU mknod fails EEXIST when the path exists as ANY node type (probed:
plain file and fifo alike, rc 1). The row's fixture used mkfifo — the
MSYS fifo emulation keeps the pipe outside the filesystem path, so
the rust mknod's GetFileAttributesW EEXIST check never saw the
fixture on the CI runner (mn03 r_rc=0 vs g_rc=1, ledger 43719808812
fs-owner shard). A plain-file fixture is byte-deterministic on every
side.

Verified: run-gate.sh mknod → 28/0 GNU-gated on the fixed fixture
(GNU oracle 9.4 / Ubuntu 24.04.4).

* fix(gate): GNU 9.4 sweep — nice/hostid rows + posix shard preflight + fixture prefixes (#1767)

Third family of the #1767 first-honest-scoring sweep (G2 report:
devin-out-G2.md). All three verdicts are runner/oracle environment
rows — zero rust2 code changes:

- nice/nc01-bare strict->exit: the stdout IS the machine-bound
  niceness. GH runners start worker processes BelowNormal
  (actions/runner-images#7663), so both Windows sides print 10 while
  the WSL oracle prints 0 — rust==cpp, both != gnu, exactly the
  ledger signature. exit keeps the GNU rc anchor (rc is always 0);
  precedent mk19/sl20/sy01.
- hostid/ho17-flagish-operand exit->win: g_rc=124 is the timeout(1)
  kill — a fresh CI WSL lacks /etc/hostid, gethostid() falls to name
  resolution and stalls past 10s (ho01-plain 124 proves it is not
  the -- spelling). win = rust-vs-cpp rc parity on the platform-bound
  machine-id output; precedent wa04/gr02. The workflow also pre-seeds
  /etc/hostid non-fatally (printf 4 bytes -> GNU prints 21483247,
  verified end-to-end locally) — an oracle-honesty fix in the same
  class as the #1766 distro pin and #1729 locale pin.
- posix shard never ran: the workflow filtered --posix-mode out of
  progs, leaving preflight 'no command names given' exit 2 and no
  ledger. Preflight now takes the program set from cases-posix/*.tsv;
  run-gate.sh pre-creates the three GNU sandbox prefix mirrors,
  clearing chp01/mkp01 pendings. Local shard run 30/30 (4 strict +
  26 posix-ok, 0 pending).

Verified: run-gate.sh nice hostid -> GNU-gated 31 pass / 0 fail (the
2 local win-row fails are the local CPP_BIN's own 127 artifact, not
present in the CI runtime package); YAML safe_load OK.
caomengxuan666 added a commit that referenced this pull request Nov 16, 2026
…YS TEMP=/tmp broke -p /tmp on CI (#1767)

mktemp.rs carried its own TMPDIR/TEMP/TMP env loop that trusted the
values verbatim. Under a Git Bash parent (the CI shard env), TEMP/TMP
arrive as the MSYS form '/tmp' itself: /tmp resolved circularly to
/tmp, and every -p /tmp creation failed rc 1 on the runner
(fs-dirs mk16-p-dir) while local runs passed (local parents keep the
Windows form). winux_core path.rs tmp_base (landed with #1766)
already solves this class — POSIX-spelled candidates are skipped and
GetTempPathW (which skips non-existent candidates) provides the
per-user temp — so mktemp now delegates to it instead of duplicating
the priority loop.

Verified: TEMP=/tmp TMP=/tmp driver mktemp -p /tmp mk16.XXXXXX ->
creates in %LOCALAPPDATA%/Temp rc 0 (was rc 1); mktemp 8/8.
caomengxuan666 added a commit that referenced this pull request Nov 16, 2026
…YS TEMP=/tmp broke -p /tmp on CI (#1767) (#1792)

* fix(mktemp): resolve the default dir through winux_core tmp_base — MSYS TEMP=/tmp broke -p /tmp on CI (#1767)

mktemp.rs carried its own TMPDIR/TEMP/TMP env loop that trusted the
values verbatim. Under a Git Bash parent (the CI shard env), TEMP/TMP
arrive as the MSYS form '/tmp' itself: /tmp resolved circularly to
/tmp, and every -p /tmp creation failed rc 1 on the runner
(fs-dirs mk16-p-dir) while local runs passed (local parents keep the
Windows form). winux_core path.rs tmp_base (landed with #1766)
already solves this class — POSIX-spelled candidates are skipped and
GetTempPathW (which skips non-existent candidates) provides the
per-user temp — so mktemp now delegates to it instead of duplicating
the priority loop.

Verified: TEMP=/tmp TMP=/tmp driver mktemp -p /tmp mk16.XXXXXX ->
creates in %LOCALAPPDATA%/Temp rc 0 (was rc 1); mktemp 8/8.

* test(mktemp): diagnostic string-form path comparison for the default-template TMPDIR row

The CI runner fails equivalent(parent, out_dir) but passes locally —
and equivalent() prints neither path, leaving the mismatch
undiagnosable. lexically_normal().string() comparison prints both
sides on failure (and is case/slash-tolerant).

* fix(winux-core): resolve-then-adopt POSIX-spelled tmp_base candidates (#1792)

mk16 CI root cause (diagnostic run: created parent = runner TEMP root
while TMPDIR named an existing harness dir): tmp_base discarded EVERY
'/'-prefixed candidate, including the MSYS drive spelling /c/Users/...
that the C++ unit harness feeds as TMPDIR. The fold chain the dialect
already owns resolves that spelling natively, so the skip threw away a
usable candidate and dropped mktemp onto TEMP.

tmp_base now folds /cygdrive/X, /mnt/X and /X onto the drive form
(normalize_api_operand_w's chain, #1145 #1172 #1231) and adopts the
candidate only when the folded path names an existing directory;
/tmp and /var/tmp stay unadopted because shell_tree_map maps them
THROUGH tmp_base (the circular mapping the mk16-p-dir finding
removed), and every other unusable value falls through to the next
candidate, keeping niubash#94's usable-per-user-temp fallback.

GNU anchor: coreutils 9.4 mktemp.c get_temp_dir honors TMPDIR
verbatim (src/mktemp.c, set_program_name/default template path);
the fold adopts exactly the spellings that name a real directory in
the shell dialect, which is what the #1761 re-pin test (probe:
coreutils emits '~' inside TMPDIR unchanged) already required the
display side to honor.

Verified: cargo test winux-core 33/33 + mktemp 8/8; driver probes
(no-positional mktemp, the CI harness shape): TMPDIR=/d/repo ->
created D:/repo/tmp.* (adopted), TMPDIR=/tmp -> GetTempPathW root
(circular fell through). WSL GNU 9.4 oracle probe confirms an
explicit-template mktemp never consults TMPDIR (bare CWD name), so
the adoption changes only the implied-tmpdir path the harness uses.

Also: rustfmt on fsutil.rs (repo-wide hook).

* fix(mktemp): route -p /tmp|/var/tmp through the temp namespace (#1792)

mk16-p-dir (fs-dirs shard, exit mode) had r_rc=1 where GNU has a real
/tmp and exits 0: shell_tree_map's install-root gate precedes the /tmp
arm, so without WINUXSH_ROOT the -p operand fell through to the generic
resolve and the spelling joined the cwd drive (C:\tmp), which the CI
runner does not have.

GNU uses the -p operand as dest_dir verbatim (src/mktemp.c:276-310) and
prints file_name_concat(dest_dir, template) (src/mktemp.c:341); the
Windows counterpart of "a real /tmp" is tmp_base (niubash#94). Extract
that mapping into winux_core::path::tmp_namespace_map — the single owner
of /tmp = tmp_base and /var/tmp = <tmp_base>/var/tmp
(native_path.cppm:257/:262) — and have both shell_tree_map (inside its
root gate, semantics unchanged) and mktemp's -p arm use it.

Review of the branch draft also fixed two defects:
  * /var/tmp was mapped to tmp_base itself, not <tmp_base>/var/tmp, so
    `-p /var/tmp` created in the temp root;
  * display_join kept a trailing separator run (`-p D//` printed
    `D//name`); GNU collapses it (probed 9.4: D/, D//, D/// all print
    `D/name`).

Tests: mktemp p_dir_bare_tmp_namespace_creates_via_tmp_base (four
spellings; display prefix + on-disk location), winux-core
tmp_namespace_maps_without_a_shell_root (root-less mapping, negative
spellings, shell-tree parity). cargo test -p winux-cmds: 1018 passed;
cargo test -p winux-core: 34 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.

[test] W 波接线后的陈旧 C++ pin 家族:mktemp/find/dir/cp-symlink 共 10 例在 main 上持续红

1 participant