Repository navigation
fix(host): stdin-script (-s) reads on demand through the engine driver (rubash#586 host half) - #314
Merged
Merged
Conversation
…r (rubash#586 host half) niu -s used to slurp the whole stdin with read_to_string before handing one big string to execute_script: $(exec cat)/read/top-level exec hit EOF immediately and the unconsumed tail came back as code (data-as-code, rc 127). rubash#593 moved the GNU-correct on-demand driver into the lib (input.c:381-397 non-seekable 1-byte parser buffer); the host now calls it instead of slurping. Byte-verified against WSL GNU bash 5.3.0 on the issue repro (printf 'echo one\nv=$(exec cat)\necho "v=[$v]"\nMARKER-DATA-1\nMARKER-DATA-2' | niu -s): both print "one", rc 0, markers consumed as data.
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.
Host-side follow-up to unixwin/rubash#593 (merged):
niu -sused to slurp the whole stdin withread_to_stringbefore handing one big string toexecute_script—$(exec cat)/read/a top-levelexechit EOF immediately and the unconsumed tail came back as code (data-as-code, rc 127). rubash#593 moved the GNU-correct on-demand driver into the lib (input.c:381-397: a non-seekable stdin gets a 1-byte parser buffer); the host now callsrubash::script_driver::run_stdin_script(&mut shell.executor)instead of slurping.Byte-verified against WSL GNU bash 5.3.0 on the issue repro:
Both print
one, rc 0 — the marker lines are consumed as data and never execute.Validation:
RUSTFLAGS="-D warnings" cargo check -p niubashgreen,cargo fmt --checkclean. Note for the release notes: this changesniu -sstdin consumption semantics to GNU (the on-demand shape), which is the contract fix, not a regression.