Repository navigation
WIP: vfs S1+S2 — special-path registry + open-ladder convergence - #1906
Merged
Merged
Conversation
…/special_paths.rs Per the vfs audit §4.3/§4.5 (slice S1): one registry + classifier (classify_special_path) now owns the net-target, null-device, fd-alias and synthetic-/proc judgments that were copied across the executor (audit §3.2: nine copies of special-path knowledge). The registry bodies are verbatim moves of the legacy judgments: - Executor::is_net_redirect_target is deleted; its 7 call sites (shell_options L1/L2, trap_exec persistent arms, redirection guards) now call special_paths::is_net_redirect_target. - executor::path::is_shell_null_device and execution_misc::dev_stdio_redirect_fd become re-exports of the registry definitions, keeping every existing call path valid. - All 9 synthetic-/proc consumers (open ladders, existence probes, fd-table opens) now ask special_paths::synthetic_proc_content, which delegates to proc_vfs generation; the Windows-only boundary follows the proc_vfs cfg precedent (audit §4.2) — off Windows the synthetic class is empty and real procfs serves the path. Zero behavior change: a lib battery test pins classify_special_path plus every per-class query against restatements of the legacy judgments over a 40-spelling matrix, including the /proc/self/fd/N overlap (fd alias wins, as the reference ladder has always ordered it) and the cfg(windows)-only NUL and synthetic classes. The namespace-bridge exclusion is not migrated or reshaped (audit §3.4: its current form is the convergence ceiling).
…roc/net steps (Fixes #1904) Per the vfs audit §3.3 census and §4.5 slice S2, the special-path step sequence now exists once per ladder family instead of six hand-written subsets: - Input ladder (shell_options::open_input_redirect_impl): the special-path prefix is extracted into open_classified_input, which walks the registry in canonical order (net, null, fd alias, synthetic content) and constructs each class's read endpoint; the pipe materialization is factored into synthetic_content_file. The ladder keeps its semantic tail (exe-spelling resolution, procsub consume, fifo probe, anchored filesystem open), and the closed-fd-alias fall-through to the literal open (#545 ENOENT semantics) is preserved exactly: the helper answers None for that one case. - Quick-read ladder (command_substitution::comsub_cat_file_substitute, the $(<file) shape): gains the missing steps in canonical order — net (connect + read to EOF), null (empty, rc 0), synthetic /proc content — resolving through the registry before the plain filesystem read. This is the #1904 fix: GNU read_comsub (subst.c) collects bytes from the descriptor the redirect open produced, whatever class the target belongs to; the ladder's error arm is factored into one fail closure the new arms share verbatim. - String-stdin ladder (stdin_string_for_command): declines net targets explicitly by registry class — the string channel never slurps a socket (a connected UDP socket has no EOF); the bind machinery performs the netopen. Previously the decline happened only by accident when the mapped pseudo-path failed to open. - Fd layer (fd/windows_impl): FdTable::open_read and open_file_read both resolve the synthetic class through the single registry entry (landed in S1); comments now record that the only remaining difference is input shape (POSIX spelling vs an already-translated Path), not the judgment. - Output and persistent-redirect ladders keep their pre-step semantics (noclobber, guarded create) and consume the registry queries landed in S1; their step order already matched the canonical one. Regression pins (tests/regression.rs, mod issue_1904): $(</proc/meminfo) yields the MemTotal content, $(</dev/null) is empty rc 0, and loopback $(</dev/tcp/127.0.0.1/<port>) returns the served bytes.
CI goldens on PR #1906 caught the Windows face of the new L4 net step: the connect succeeded but reading the endpoint back failed EINVAL. tcp_stream_file adopts the SOCKET as a std File handle for the fd machinery; std File::read passes a NULL OVERLAPPED to ReadFile, which an overlapped std socket rejects with ERROR_INVALID_PARAMETER on Windows (Linux reads the same File fine, so the local pins stayed green). Split the netopen: connect_net_stream parses + connects and returns the endpoint as a NetStream (TcpStream/UdpSocket, reads via WSARecv/recv); open_net_redirect_raw keeps its exact prior contract by converting that stream to the adopted File, so the L1/L2/L5 consumers and both #1237 diagnostic pre-lines are unchanged. The quick-read ladder reads through the socket form.
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.
WIP: vfs unified layer S1+S2 — special-path registry + open-ladder convergence
Implements slices S1 and S2 of the vfs audit proposal (§4.3 structure, §4.5 slice order; audit REPORT §3 census: 89
"/dev/"literals / 9 copies of special-path knowledge / 6 hand-written open ladders). Two commit groups:S1 — registry move (zero behavior change). New
src/special_paths.rs: a single registry + classifier (classify_special_path→ NetRedirect / NullDevice / FdAlias / SyntheticProc / Filesystem) and the per-class queries every consumer now asks. The judgment bodies are verbatim moves:Executor::is_net_redirect_targetis deleted (7 call sites converted),path::is_shell_null_deviceandexecution_misc::dev_stdio_redirect_fdbecome re-exports, and all 9 synthetic-/proc consumers go throughspecial_paths::synthetic_proc_content(generation stays inproc_vfs, Windows-only per §4.2; off Windows the synthetic class is empty). Equivalence is proven by a lib battery test pinning classify + each query against restatements of the legacy judgments over a 40-spelling matrix (incl. the/proc/self/fd/Nalias-wins overlap, cfg(windows)-onlyNUL/ synthetic classes). The namespace-bridge exclusion is deliberately not migrated or reshaped (audit §3.4).S2 — ladder convergence. The input ladder's special-path prefix is extracted into
open_classified_input(canonical step order: net → null → fd alias → synthetic → filesystem tail; the closed-alias fall-through to the literal open is preserved exactly), the quick-read ladder$(<file)gains the proc/net/null steps it was missing, the string-stdin ladder declines net targets explicitly by class instead of by accident, and both fd-layer read entries resolve the synthetic class through the one registry entry.Fixes #1904
#1904 evidence: three regression pins named
issue1904_*intests/regression.rs(CI-executed via the goldens job):$(</proc/meminfo)yields the MemTotal content,$(</dev/null)is empty rc 0, and loopback$(</dev/tcp/127.0.0.1/<port>)returns the served bytes. GNU grounding:read_comsub(subst.c) collects bytes from the descriptor the redirect open produced, whatever class the target is.Gates (all green): local lib failure set identical by name to the pristine 231ffe1 baseline (869 passed / 1 failed / 3 ignored on the final tree; sole failure
ownership_unary_operators_check_existing_file, +1 passed = the registry battery);-D warningsclean; diffcorpus 306/306 PASS; per-file rustfmt (my hunks clean; four files carry pre-existing pristine drift, untouched); CR=0. Local windows-gnu check is unavailable in the VM (thepsmdependency's build script fails under the cross toolchain, tree-independent — this PR changes no Cargo files); the Windows face is evidenced by CI per the audit §4.7 caliber: run 40612463122 fully green (goldens incl. all threeissue1904_*pins on Windows, Rust tests Windows+macOS, cross-target darwin + linux/android, shell functionality) plus run 40612463219 (API ledger, niubash paired build). First CI round (40611154431) caught one real Windows-face defect in the new net step — reading the endpoint through the handle-adopted std File fails EINVAL on Windows (overlapped socket) — fixed in3fb3684eby splitting the netopen:connect_net_streamreturns the native socket form for byte consumers,open_net_redirect_rawkeeps its exact prior File contract for the fd machinery.Out of scope (later slices, not touched): S3 mapping confluence, S4 test fixes (#1901/#1902), S5 niu completion+highlighting (#627/#628), S6 cross-repo table (#1903/#1905), D1–D7 defect bodies (#1894–#1900).