fix(exec): detach child stdin to /dev/null so commits don't hang on a serial console#118
Merged
Merged
Conversation
Closed
1 task
…'t block on a serial console Exec() redirects the child's stdout/stderr but leaves stdin inherited from the parent (hex_config). On a serial-console install (IPMI Serial-over-LAN, /dev/ttyS0) the commit subprocesses inherit that UART as stdin. Tools that initialize a terminal on stdin -- e.g. mongosh during the mongodb module commit -- then block forever opening the controlling TTY in tty_port_block_til_ready (waiting for carrier; CLOCAL unset), stalling the entire policy apply at the mongodb stage. Commit subprocesses never read stdin, so redirect it to /dev/null, mirroring the existing stdout/stderr /dev/null handling. This makes commits independent of the console type (serial/SOL vs VGA). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Travis Wu <travis.wu@bigstack.co>
Add test_exec_stdin_01, which gives the parent process a non-/dev/null stdin and asserts an Exec()-spawned child still sees /dev/null -- guarding the serial-console hang fix. Wire a tests/ dir into the SDK library Makefile, since exec.cpp is compiled directly at the SDK root. Also condense the inline comment on the stdin redirect. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Travis Wu <travis.wu@bigstack.co>
a62821c to
f9ec378
Compare
leechienpang
approved these changes
Jun 29, 2026
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.
What type of PR is this?
/kind bug
What this PR does / why we need it
On a serial-console install (IPMI Serial-over-LAN,
/dev/ttyS0),hex_config's commit subprocesses inherit the UART as stdin.Exec()redirected the child's stdout/stderr but left stdin inherited from the parent. Tools that initialize a terminal on stdin — e.g.mongoshduring the mongodb module commit — then block forever opening the controlling TTY intty_port_block_til_ready(waiting for carrier;CLOCALunset), stalling the entire policy apply at the mongodb stage. VGA/console installs are unaffected because their stdin is not a blocking UART.Commit subprocesses never read stdin, so this redirects the child's stdin to
/dev/nullinExec(), mirroring the existing stdout/stderr/dev/nullhandling. Commits become independent of console type (serial/SoL vs VGA).Which issue(s) this PR fixes
Fixes bigstack-oss/cubecos#1016 (the cubecos tracking issue; cubecos picks up this fix via a hex submodule bump).
Special notes for your reviewer
Adds
test_exec_stdin_01: gives the parent process a non-/dev/nullstdin (/dev/zero) and asserts that anExec()-spawned child still sees/dev/null. Confirmed it fails without the fix (child inherits/dev/zero) and passes with it. Fullhex_sdk_librarymake testis green (128/128) in the centos9 jail.Also verified end-to-end downstream: a full serial-console (SoL) CubeCOS install on a build carrying this fix completes all 22 bootstrap stages — the mongodb stage no longer hangs.
Additional documentation
🤖 Generated with Claude Code