Repository navigation
WIP: fix/2042 fd-registry residuals — items 1+5 fixed, 2/3/4 triaged - #2089
Merged
Merged
Conversation
… like GNU GNU procfs content files (/proc/<pid>/status, cmdline) are 0644 with no write handler: the open succeeds and every write fails EINVAL, rendered by the builtin in its own name via sh_chkwrite (builtins/common.c:320-334; measured on WSL GNU 5.3.20: "echo hi > /proc/self/status" -> "echo: write error: Invalid argument", rc 1). The absorbed temp sink made these writes silently succeed on every bind face. Mirror the rubash#1898 FullDevice symbolic-endpoint pattern with FdWriteEndpoint::ProcContentWrite / OutputTarget::ProcContentWrite: the in-shell write faces render "Invalid argument" through the same sh_chkwrite channel; the external child face keeps the absorbed sink (Windows has no per-write-EINVAL handle; the child's own diagnostics belong to the child binary). Exec-level output binds previously fell through to a phantom enclave file at the literal path - now bind the entry's write class. GNU anchors: proc_vfs.rs proc_content_write_allowed (0644/0444 classes, measured); procfs content entries answer EINVAL without mutating what a later read serves (the failed write never lands). Regression pins: tests/issue2042_proc_write_einval_regressions.rs (direct write/append, bound 3<> read+write, exec 3> no-phantom, dup class). Fixes #2042 (item 1 of 5; items 2/3/4 triaged in the batch report).
…ellings GNU answers "test -r" TRUE for every live /proc/<pid>/fd/N magic link regardless of the fd's open mode: sh_eaccess (test.c:553 -> lib/sh/eaccess.c:194) on real procfs says yes for an lr-x read-only regular file, an l-wx write-only append descriptor, and an lr-x /dev/null descriptor alike (uid-1 measurement on WSL GNU 5.3.20). Rubash's pipe-mark face (__RUBASH_FD_PIPE_<fd>, rubash#1467) covered only pipe handles; a file-backed descriptor fell through to a filesystem that has no such names and answered false. Two roots fixed: - Coverage: file-backed descriptors carry __RUBASH_FD_FILE_<fd> (rewritten fresh each call beside the pipe marks), and a new fd_file_test face in builtins/test.rs answers -r for a marked fd. Only -r is answered - the rest of the unary matrix keeps its historical fall-through (issue scope); the pipe class keeps its #1467 verdict matrix. - Admission: the fused-scan gate in execute_test_words hand-listed the /dev/fd/ and /proc/self/fd/ prefixes and missed the numeric-pid spelling /proc/<pid>/fd/N (rubash#1974 own_pid_fd_tail), so a test whose only fd operand was /proc/$$/fd/N skipped the mark refresh and read stale marks from a previous dispatch (deterministic false at the first test). The gate now asks the registry's own judgment (fd_alias_target) - one check for the whole spelling class. Regression pins: tests/issue2042_filefd_test_r_regressions.rs (both spellings x read/write binds, first-dispatch freshness, closed fd stays false, pipe matrix unchanged). Fixes #2042 (item 5 of 5).
caomengxuan666
force-pushed
the
fix/2042-fd-registry-residuals
branch
from
October 29, 2026 08:42
28dc05b to
3027277
Compare
This was referenced Oct 29, 2026
caomengxuan666
marked this pull request as ready for review
October 29, 2026 10:55
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.
Summary
Issue #2042 lists five fd-registry residuals from PR #2015. Per the batch discipline (triage on current master first, fix the survivors), this branch:
22d046a1): 0644-class synthetic /proc entries bind the new symbolicFdWriteEndpoint::ProcContentWrite/OutputTarget::ProcContentWrite; in-shell write faces render<name>: write error: Invalid argument(sh_chkwrite channel, builtins/common.c:320-334) exactly like GNU — measured:echo hi > /proc/self/status→echo: write error: Invalid argument, rc 1 on both sides. Exec-level3>previously created a phantom enclave file; now binds the class. External child face keeps the absorbed sink (no Windows per-write-EINVAL handle; child diagnostics are the child binary's).test -r— FIXED (30272772): GNU answers -r TRUE for every live fd magic link regardless of open mode (uid-1 procfs measurement: lr-x regular, l-wx append, lr-x /dev/null all yes). Added the__RUBASH_FD_FILE_<fd>mark +fd_file_testface (-r only, per issue scope), and fixed the fused-scan admission gate which missed the numeric-pid spelling/proc/<pid>/fd/N(rubash#1974) so the first dispatch read stale marks — the gate now asks the registry's ownfd_alias_target.Permission deniedon the native dir open inopen_classified_input's SyntheticLink arm) where GNU opens and the child fails at read (cat: -: Is a directory); this also kills stdin-ignoring commands (ls < /proc/self/cwdmust run, rc 0). Root cause pinned in the batch report; the fix needs a child-handle design decision beyond this batch.ls: write error: No space left on device(rc 2); Windows has no handle whose writes fail ERROR_DISK_FULL, and rubash cannot honestly forge the child's diagnostic or exit status. Builtin faces already aligned ([bug] /dev/zero、/dev/full 在 Windows 未模拟(打开即失败;/dev/full 丢失 ENOSPC 写形状) #1898).exec 3<>/dev/tcp/127.0.0.1/Pperforms exactly ONE connection (== GNU's one open per redirect, redir.c do_redirections); the input face likewise one. The probe ladders (>> and <>) bypass special-path registry classification; append probe preempts even external commands; /dev/tcp unreachable through them #1964-era probe-ladder double-open is closed on current master. Incidental (not one of the five):echo hi > /dev/tcp/…reportswrite error: Invalid argumentwhere GNU's closed-peer shape would be EPIPE — recorded for a future issue.Verification
wsl bash <file>form; wsl.exe arg translation mangles the direct form on this host).results/gnu_i*.txtvsresults/rub_i*_fixed.txt).cargo test --release: new pins green (issue2042_proc_write_einval_regressions4/4,issue2042_filefd_test_r_regressions4/4). Full suite A/B vs pristine03ae580d: identical results — 5 test targets are pre-broken on Windows (unconditionalstd::os::uniximports;typed_cell_coherence_fuzzneeds debug_assertions), disabled for the run and restored;cli_testsfailure set identical to pristine except the dirty-tree version-metadata artifact (both lists archived in the batch report).cargo fmtrun explicitly (rustfmt --check clean on all changed files); commits used--no-verifybecause the pre-commit hook'scargo fmt --checkcrashes on this host with OS error 206 (command line too long) in the deep worktree path.Fixes #2042 (items 1 and 5; 2/3/4 verdicts registered here and in the batch report).
D:/repo/nbbuild/pkg10/F/REPORT.md,probes/,results/