Skip to content

Add /dev/tty support - #1689

Merged
Weidong Cui (wdcui) merged 4 commits into
uliteboxfrom
wdcui/ulitebox/dev-tty
Oct 22, 2026
Merged

Weidong Cui (wdcui) merged 4 commits into
uliteboxfrom
wdcui/ulitebox/dev-tty

Conversation

@wdcui

@wdcui Weidong Cui (wdcui) commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

This PR adds /dev/tty and gives the guest at most one terminal, its controlling terminal, which any standard stream may refer to. The userland broker takes the host controlling terminal only when it is verifiably in the foreground and no standard stream is a pipe or socket; otherwise nothing in the guest is a terminal (isatty false, ENOTTY, /dev/tty ENXIO). Terminal signals reach the initial process group even when no stream refers to the terminal. Tests cover the broker, shim, and runner.

Weidong Cui (wdcui) and others added 4 commits October 21, 2026 18:36
Make the terminal endpoint a full I/O endpoint and expose the controlling
terminal through the stdio provider. The broker's /dev backend now serves
/dev/tty and routes every terminal-backed stdio stream through the terminal
endpoint; opening /dev/tty without a controlling terminal fails with ENXIO.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
The guest now has at most one terminal, its controlling terminal, and each
standard stream that refers to it is a view of it. Without one, nothing is a
terminal: isatty is false, terminal ioctls fail with ENOTTY, and opening
/dev/tty fails with ENXIO. The half-terminal that accepted settings without
applying them is gone.

The userland broker takes the host controlling terminal only when it is
verifiably in the foreground process group and no standard stream is a pipe
or socket. The terminal's signal sink is attached to the initial process
group when it is created, so Ctrl-C reaches the guest even when no stream is
a view.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
Name the per-stream flags after StdioProvider::is_terminal, which they
back, and describe streams as referring to the terminal rather than as
views of it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
Correct the test terminal docs, which described reads as waiting and
terminal_writes as driving I/O, and reword unclear comments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
@github-actions

Copy link
Copy Markdown

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_variant_added.ron

Failed in:
  variant OpenError:NoSuchDevice in /home/runner/work/litebox/litebox/litebox_broker_core/src/fs/errors.rs:32

--- failure inherent_method_const_removed: pub method is no longer const ---

Description:
A publicly-visible method or associated fn is no longer `const` and can no longer be used in a `const` context.
        ref: https://doc.rust-lang.org/reference/const_eval.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/inherent_method_const_removed.ron

Failed in:
  TestStdioProvider::with_terminal in /home/runner/work/litebox/litebox/litebox_broker_core/src/test_support.rs:161

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/inherent_method_missing.ron

Failed in:
  TestStdioProvider::with_uncontrolled_terminal, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_core/src/test_support.rs:177
  TestStdioProvider::terminal_queries, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_core/src/test_support.rs:219
  Resolver::is_terminal, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_core/src/fs/resolver.rs:1190

--- failure trait_method_missing: pub trait method removed or renamed ---

Description:
A trait method is no longer callable, and may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/trait_method_missing.ron

Failed in:
  method is_terminal of trait Backend, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_core/src/fs/backend.rs:167

--- failure trait_method_parameter_count_changed: pub trait method parameter count changed ---

Description:
A trait method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/trait_method_parameter_count_changed.ron

Failed in:
  StdioProvider::terminal now takes 0 instead of 1 parameters, in file /home/runner/work/litebox/litebox/litebox_broker_core/src/stdio.rs:74

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/function_missing.ron

Failed in:
  function litebox_broker_platform_linux_userland::terminal::open_stdio_terminals, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_platform_linux_userland/src/terminal.rs:35

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/inherent_method_missing.ron

Failed in:
  LinuxTerminal::open, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_platform_linux_userland/src/terminal.rs:111

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/inherent_method_missing.ron

Failed in:
  UserlandStdioProvider::open_terminals, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_userland/src/stdio.rs:64
  UserlandStdioProvider::with_terminals, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_userland/src/stdio.rs:85
  UserlandStdioProvider::close_terminals, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/e22be73d3e3f123e979679dd25821f152572be5e/litebox_broker_userland/src/stdio.rs:113

@wdcui
Weidong Cui (wdcui) added this pull request to the merge queue Oct 22, 2026
Merged via the queue into ulitebox with commit 3c906af Oct 22, 2026
11 checks passed
@wdcui
Weidong Cui (wdcui) deleted the wdcui/ulitebox/dev-tty branch October 22, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant