Repository navigation
Report errors and exit statuses, add ping and an end marker for scripted runs - #26
Merged
Merged
Conversation
rickgaiser
force-pushed
the
runner-improvements
branch
from
October 25, 2026 18:21
7c9aa72 to
8e2b26b
Compare
Fixes: - Report a failed connection instead of waiting for the timeout; connect with a 3 s timeout; do not crash on an unknown hostname. - Fail when the console port is in use (another ps2client) instead of running without console output. - Exit with meaningful statuses: 64 usage, 69 ps2link not answering, 74 ps2link closed the connection, 75 console port in use. - Detect ps2link closing the connection instead of spinning at 100% CPU; ignore SIGPIPE. - Print console packets byte-exact (they are not null-terminated) and receive packets up to 64 KB instead of cutting them off at 1 KB. - Check the length of execee/execiop arguments and the number of arguments of each command; parse 0x numbers. - gsexec sent its size with htonl into a short (always 0). - Bounds checks for request packets and directory descriptors; initialize getstat data when stat fails. - Error messages go to stderr, so stdout is only the ps2 console. Features: - ping: check that ps2link answers through a host: request (EE side, IOP side and host connection), without writing a file. - -e <marker>: exit when a console line contains the marker, with the number after "status=" as exit status (124 on idle timeout first). - Commands that use host: files first wait until ps2link answers that check, instead of a fixed 1 s sleep. - dumpreg accepts register type names.
rickgaiser
force-pushed
the
runner-improvements
branch
from
October 25, 2026 18:53
8e2b26b to
8bdf203
Compare
tests/run-tests.sh runs ps2client against tests/fake_ps2link.py in unprivileged Linux network namespaces, so no ps2 is needed. It covers the error paths, exit statuses, ping, the end marker, console packets, host: file reads and the handshake retry.
rickgaiser
force-pushed
the
runner-improvements
branch
from
October 25, 2026 18:59
8bdf203 to
a51890b
Compare
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.
This makes ps2client usable from scripts and test runners: it now says what went wrong, with an exit status, instead of silently waiting for the timeout.
Fixes
ps2link_connectalways returned 0, so a ps2 that was off or not running ps2link only showed up as a timeout. ps2client now exits with an error, and connecting gives up after 3 s instead of the kernel's ~2 minutes. An unknown hostname no longer crashes it.recvreturned 0 forever and the request thread spun at 100% CPU. Now ps2client exits. SIGPIPE is ignored, so a send on a closed connection no longer kills it.printf("%s")from an uninitialized buffer. Packets over 1 KB were cut off by the receive buffer.execee/execioparguments longer than the 256-byte packet field overflowed the stack. Missing arguments (e.g.dumpmemwith one argument) dereferenced NULL. Numbers accept0x.gsexecsent its size withhtonlinto ashort, so it was always 0 on little-endian hosts.getstatno longer sends uninitialized data whenstatfails.Additions
-emarker. Error messages go to stderr, so stdout carries only the ps2 console.-e <marker>: exit when a console line contains the marker. The exit status is the number afterstatus=on that line, e.g. a test printing@@END@@ status=1as its last line.ping: checks that ps2link answers through a host: request (EE side, IOP side and host connection), without writing a file. Exit 0 with the round trip time, or 69.sleep(1).dumpregaccepts register type names (dma,intc, ...,vu1) as well as numbers.Behaviour changes
reset,poweroffand the other commands that exit right away no longer open the request connection or bind the console port.ping: ps2link serves one host connection and a new client replaces the old one. Like any ps2client command, a ping cuts off the host: files of a program that is running.Testing
tests/run-tests.shruns ps2client against a fake ps2link (tests/fake_ps2link.py) in unprivileged Linux network namespaces, so no ps2 is needed. 36 checks: error paths, exit statuses, ping, the end marker, console packets, host: reads and the handshake retry.-e,ping).🤖 Generated with Claude Code