Repository navigation
fix(builtins): bare builtin applies its redirections (rubash#1643) - #1682
Closed
arookieofc wants to merge 1 commit into
Closed
arookieofc wants to merge 1 commit into
arookieofc wants to merge 1 commit into
Conversation
GNU execute_builtin applies a simple command's redirections before the builtin runs, even when the builtin takes no arguments. The bare-'builtin' early return in execute_builtin_direct_command skipped that pass entirely, so 'builtin > f' created no file and 'builtin > f' on an existing file did not truncate it — while 'command' and ':' take their own redirect passes and agreed with GNU. The early return now applies the same no-output-builtin redirect pass the ':' arm uses (in/out/append/err), with the same status rule: failed redirect -> 1, otherwise 0. Regression tests: tests/issue1643_bare_builtin_redirect_regressions.rs (5 tests: create, append + stderr targets, truncate, failed redirect rc=1 with diagnostic, '--' form and plain no-op).
Member
|
Closing as incorporated per the 2026-10-26 fd-source dual-route ruling (recorded in DECISIONS.md; full comparison in the collab PR review report §3.1/§4.3). The slice PR #1689 was chosen as the single landing route for #1643 and has merged (merge commit
Thanks for the contribution — it independently reached the same fix and served as the cross-check for the ruling. |
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.
Fixes #1643.
GNU execute_builtin applies a simple command's redirections before the builtin runs, even when the builtin takes no arguments. The bare-
builtinearly return in execute_builtin_direct_command skipped that pass entirely, sobuiltin > fcreated no file andbuiltin > fon an existing file did not truncate it — whilecommandand:take their own redirect passes and agreed with GNU.The early return now applies the same no-output-builtin redirect pass the
:arm uses (in/out/append/err), with the same status rule: failed redirect -> 1, otherwise 0.Verification (local, master 499a5e2 + this fix, vs GNU):
builtin > fcreates f,builtin >> fcreates f,builtin 2> ecreates e, existing file truncated to 0 — all matching GNU.builtin < /dev/nullrc 0 andbuiltin echo HI > funchanged; failing redirect reports the target and rc 1, matching GNU;builtin -- > falso creates f.