Skip to content

WIP: fix #2524 #2533 #2534 #2535 - #2549

Merged
caomengxuan666 merged 4 commits into
masterfrom
fix/2524-small-engine
Nov 2, 2026
Merged

caomengxuan666 merged 4 commits into
masterfrom
fix/2524-small-engine

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Refs #2524
Refs #2533
Refs #2534
Refs #2535

GNU builtins/mapfile.def:258 validates the -u descriptor with
sh_validfd: it must be open in the shell. fd 0's open transports are
wider than the fd table - the FUNCTION_STDIN mirror a pipeline stage
parks its input on and the inherited process stdin - and
mapfile_input_for_command's fd-0 serve consults exactly those, but
mapfile_fd_is_available never did, so `printf 'x\ny\n' | { mapfile
-t -u 0 arr; }` died at the gate with EBADF while the serve path held
the bytes. The gate now agrees with the serve for fd 0 (mirror counts
only while fd 0 is not closed, mirroring the serve's own condition);
fd != 0 semantics unchanged.
…atus (Refs #2524)

GNU variables.c:6291 set_pipestatus_array writes the ONE array
object; rubash splits it across the status vector, the typed cell and
the env mirror. The element-assignment paths move all three together,
but the pipeline-completion writer set_pipestatus moved only the
vector: after `PIPESTATUS[2]=5`, the next command's completion left
the typed cell at the assigned value while reconcile_pipestatus_mirror
later rebuilt the mirror from the vector, and the typed-cell coherence
verifier panicked on the disagreement. set_pipestatus now renders the
vector once and syncs cell and mirror from it whenever they exist
(absent representations stay absent - the dynamic views own those
faces), then registers the pair synced.
…#2533)

plan_external_stdio opened a command-local /dev/full target through
create_redirect_output, whose rubash#1898 stand-in sink absorbs every
write - so /bin/echo hi > /dev/full exited 0 with no diagnostic. GNU
hands the child the opened device itself (redir.c do_redirections,
dup2 onto the child's fd): the write fails ENOSPC inside the child,
which diagnoses itself and exits nonzero. The planner's combined-
target opener now opens the real device on unix for a full-device
target (append and truncate alike); where that open fails the sink
contract stands for the faces that only need the open to succeed.
…reader (Refs #2535)

The ERR runner correctly propagated Err(ExitCode(9)) from a sourced
exit 9 in its action, and run_source_impl adjudicated the group
status 9 from the payload - but run_script_grouped_at_line_offset's
break return discarded the group status and returned
executor.last_exit_code(), which the trap runner had legitimately
restored to the pre-trap status (1) on its way out (trap.c:367
model). The run stopped (the jump was honored) but exited 1. An exit
jump now ends the grouped run with the group's status - GNU's
jump_to_top_level (EXITPROG) ends execution with the exit's own
status (execute_cmd.c:5537); the parse-abort arm keeps
last_exit_code.
@caomengxuan666

Copy link
Copy Markdown
Member Author

[win-acceptance] #2549 — four faces on Windows (no new pin in this PR; verification = issue repro A/B vs WSL GNU 5.3.20 script files + adjacent batteries):

No BLOCKER. Environment: Windows 10 19045 real machine, MSVC Rust debug build of master 2ce27e6 (contains this merge), oracle wsl /usr/local/bin/bash 5.3.20. Probes/logs: D:/repo/win-accept/wave3/probes/p25{24,34,35}.*, D:/repo/win-accept/wave3/logs/.

@caomengxuan666
caomengxuan666 deleted the fix/2524-small-engine branch November 3, 2026 09:06
SpookyWaste pushed a commit to SpookyWaste/rubash that referenced this pull request Nov 12, 2026
…ren (Refs unixwin#2550)

plan_external_stdio declined the whole plan whenever an ambient
fd 1/2 binding (or a dup source) was rubash#1898's symbolic
FdWriteEndpoint::FullDevice, and the legacy routes that took over
apply no ambient binding at all — so after `exec 1>/dev/full` a
foreign child inherited the HOST stdout and its writes silently
succeeded (rc 0, no diagnostic).

GNU installs the opened device itself in the shell's descriptor
table for a permanent exec redirection (redir.c:237
do_redirections -> redir.c:790 do_redirection_internal, the open
at redir.c:725 redir_open) and the forked child inherits that
descriptor (execute_cmd.c make_child): the write fails ENOSPC
inside the child, which diagnoses itself and exits 1.

Fix by mechanism: a FullDevice table binding now resolves to a
stdio slot through full_device_stdio_slot() — a fresh open of the
real device where the platform has one (an independent open is
indistinguishable; the device keeps no offset or state). Both
planner sites that resolve table bindings speak it: the fd 1/2
ambient seeding and the dup-source fallback (so `>&4` after
`exec 4>/dev/full` resolves too). Where no kernel device backs
the spelling (Windows simulation) or the open fails, the slot
stays unresolvable and the plan declines exactly as before,
keeping the unixwin#1898 sink contract for the in-shell faces. The
command-local target route is untouched (owned by unixwin#2533).

Pins: tests/issue2550_devfull_ambient.rs, 7 shapes incl. /dev/null
and regular-file controls — 7/7 green under the scrubbed harness.
Guard issue2483_stream_drain 6/6. Guard
issue1496_write_error_diag_regressions is red on this base before
and after this change (identical probe output): its failing leg
is the command-local face owned by PR unixwin#2549, not in base 9348b8d.
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