Repository navigation
Conversation
Validates with original AmigaOS Shell. This now allows invoking g++ without parameters from Shell (cherry picked from commit f8e2814)
The [CLI n] announcement went to StandardError unconditionally (unless QUIET), so 'Run >NIL: ...' still printed it, which is noise during boot. Only announce when the command's output is interactive; QUIET and the interactive case are unchanged. Fixes ApolloTeam-dev#40 (cherry picked from commit 14592dddf78f42aabfe70a103b321d2d256f3da4)
(cherry picked from commit 2948bf7a86d5d6229d273e788fff5c774a8c38a4)
A redirection whose file would not open set Result2 and nothing else, so the command silently did not run. executeLine() already prints its own failures, hence the flag. (cherry picked from commit 4622c04a6b4a465813f36d0f04bb4575931fc5fd)
(cherry picked from commit b638d1316f0964da4a8d617a09537a012699b337)
(cherry picked from commit c740f4f7aa6233759a23f34781c50388331f620b)
(cherry picked from commit c988aa538d11545c3baa6cb5f2a24b8328cc52b8)
(cherry picked from commit 0bc387a50b4faa464ca5b2717a3ad7b584e9592a)
(cherry picked from commit 4ad38eaa1547cabf4e0593b05960a53dc615bc18)
(cherry picked from commit 63ba39ea0f6349360340c48f9c3299d83ae93207)
(cherry picked from commit 8593679171bdebe7a47688f3af79ce22c13bd218)
(cherry picked from commit 278b8cb90f700113c0d0b9d71ccea8e38841a1c3)
Run needs independent child output/error handles because the parent Shell closes its redirections when the command returns. MODE_NEWFILE on the RAM-handler creates an exclusive lock; DupLockFromFH can fail with ERROR_OBJECT_IN_USE. The old nested OpenFromLock(DupLockFromFH(...)) call ignored both failures and Run could report success with no child output. Duplicate through a checked helper. Retry sharing only after ERROR_OBJECT_IN_USE, free a lock if OpenFromLock fails, and preserve the position of seekable streams so >> does not overwrite the existing prefix. Do not interpret an I/O or range error while reading the source position as a nonseekable stream: only -1/ERROR_ACTION_NOT_KNOWN permits a positionless duplicate. Reject unrepresentable LONG positions explicitly. Check NIL/input/output/error setup, centralize failure cleanup, and close handles for an empty command. Keep the existing successful CLI_RUN stream ownership transfer. The private helper is shared with a host fault test; it is not a public API. Add a native DOS regression that runs an explicit standalone Run binary, asserts launch status and exact bytes for > and >>, and checks cleanup. Temporary files live in an exclusively created test directory and are retained after failure rather than reused by a potentially active child. Add host fault injection for source/copy seek failures, range rejection, sharing and lock/handle cleanup, plus build and limitation documentation. Verified strict standalone and embedded-command x86_64 builds, native baseline FAIL/fixed PASS for overwrite and append on CON and XTerm, and host tests with ASan/UBSan. Installed/resident Run was not replaced. This LONG-based helper does not add large-file positioning, concurrent append atomicity or allocation-failure coverage of the full Shell launch. Sharing is not rolled back if a later duplication step fails. (cherry picked from commit 1d191502345fa0a54b670a0b2f4901e209d84fc4)
(cherry picked from commit 92a7198be120fd4b3b43bfc38f37ec75e698f124)
(cherry picked from commit 9d6f145b44bac5e1a2557c06825dd35f1a1af833)
Self-decrunching executables (PowerPacker, Imploder and similar stubs, very common on old disks, also used by AMOS runtimes) unpack into new memory, free their own packed hunks and put the new SegList into cli_Module for the CLI to unload. The Shell unloaded the segment it had loaded instead, so the packed hunks were freed twice and the unpacked program leaked. Unload what cli_Module holds when the command returns (resident commands are unchanged). Found with LCD Dreams (1992, Solstice), an AMOS program that now gets past its intro instead of failing with "Memory freed twice". Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit fef7adea47cfcd38d1b653efa1ab0d38f5486353)
The Shell opened every redirection on a line itself. In `Run >NIL: cmd >file` the second `>` failed with error 217 (too many levels) and the child never ran; an input redirection such as `<NIL:` was already opened during the <arg> substitution pass. Run's leading redirections still apply to Run. From the child command on, the text goes unchanged to the background CLI, which applies the child's own redirections. Input redirections now wait for the redirection pass. Shell 41.5. Ported from AROS commit bf7075aab8 by Nicolas Ramz (aros-development-team/AROS#1708), with its runcommandredir test.
Keep the original child command text instead of forwarding ReadArgs /F's unquoted first item. Skip Run's parsed options while retaining child quoting, escapes, and redirections, and preserve the existing help-prompt path. Add native launch regressions for spaced and escaped filenames, QUIET, COMMAND keywords, outer redirections, and the help prompt. The quoting regression fails on the unchanged ROM; the fixed ROM passes it and the RunBack redirection regression. (cherry picked from commit cc44e4a360ca2da151226850e6f152446967f5e6)
pulchart
force-pushed
the
wip/jpu/run-redirect
branch
from
November 22, 2026 07:25
a01967f to
44e256b
Compare
The Shell joins '+' continuation lines into Run's argument line, and the background CLI reads them from its script input. Run gave the commands the same handle as Input(). RunCommand() injects each command's arguments into Input() and flushes it afterwards, so only the first line ran. With continuation lines the commands now get their own NIL: input. The command taken from the argument line already holds these lines, so the buffered input is appended only to a single line; otherwise they would run twice. runcommandredir checks that every continued line runs once.
This branch has not been deployed
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.
The ApolloOS Shell has not changed since it left AROS in 2020. This brings the AROS fixes for the Shell and Run that apply to it. Commits taken as they are keep their authors; the Run child redirection fix had to be ported by hand to the older Shell. The first commit expands tabs to spaces in the Shell and Run sources, whitespace only, as AROS did in f6943e7 and f4f7022, so the fixes apply as they are.
Run >NIL: cmd >filethe second>failed with error 217 (too many levels) and the child never ran, silently. Ported from AROS bf7075aab8 by Nicolas Ramz (shell: preserve redirections in Run's child command aros-development-team/AROS#1708). Shell 41.5.Run >RAM:x cmdgave an empty file),>>appends instead of overwriting, andRun >NIL:no longer prints the[CLI n]line.cli_Moduleholds after a command, as the Kickstart CLI does. Self-decrunching executables (PowerPacker, Imploder) were freed twice and leaked the unpacked program (Shell: unload cli_Module after a command, like the Kickstart CLI aros-development-team/AROS#1778).T:Shell$embed<n>is deleted after use..keynames match exactly (.key AB,Agave<A>unexpanded), names longer than the limit are rejected instead of overflowing,.pushis/.popisneed the full name in any case,/Naccepts a sign.*"inside quotes is an escaped quote,+continues a line only after a space, as in AmigaOS.Run >NIL: Echo child >RAM:child.txtchild;runcommandredir0 failures, before 1Run >RAM:runout.txt Echo hellohelloRun >>RAM:app.txt Echo morePREFIXoverwrittenPREFIXkept.key AB,Awithone twoA=<A> AB=oneA=two AB=oneEcho "bt=`Echo hi`"T:Shell$embed1staysEcho >RAM:nodir/x hiobject not foundEcho "a*";b"argument line invalid or too longa";bRunwith+continuation lines