Skip to content

Support readlink of /proc/self/fd entries - #1700

Merged
Weidong Cui (wdcui) merged 4 commits into
uliteboxfrom
wdcui/ulitebox/proc-fd-links
Oct 25, 2026
Merged

Weidong Cui (wdcui) merged 4 commits into
uliteboxfrom
wdcui/ulitebox/proc-fd-links

Conversation

@wdcui

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

Copy link
Copy Markdown
Member

This PR fixes readlink of /proc/self/fd/N, which hit unimplemented!() for N ≥ 3 and crashed ttyname() on a /dev/tty descriptor. The broker now records each opened file's absolute path, with symbolic links resolved, and returns it through a new handle-based HandlePath request. The Linux shim reports that path for descriptors of broker-opened files, names other descriptors by kind as Linux does (e.g. pipe:[0]), stats these links through the descriptor itself, and returns ENOENT for descriptors that aren't open.

@wdcui
Weidong Cui (wdcui) force-pushed the wdcui/ulitebox/proc-fd-links branch 2 times, most recently from 9959318 to bd2297b Compare October 22, 2026 12:09
@wdcui Weidong Cui (wdcui) changed the title Resolve /proc/self/fd links through the broker Support readlink of /proc/self/fd entries Oct 25, 2026
Weidong Cui (wdcui) and others added 4 commits October 25, 2026 14:27
Record each broker-opened file's absolute path, with symbolic links
resolved, on its File and expose it through a new handle-based
HandlePath file request. The Linux shim uses it to answer readlink of
/proc/self/fd/N for files and names non-file descriptors by kind, so
ttyname() on /dev/tty no longer hits unimplemented!().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
Record the resolved absolute path on the resolver entry created by open
and read it through a Service::handle_path method, like handle_status,
instead of keeping a copy on File. This keeps Resolver::open's signature
and drops open_with_path_returned.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1172b488-1351-40c1-a6d0-32f5277af568
@wdcui
Weidong Cui (wdcui) force-pushed the wdcui/ulitebox/proc-fd-links branch from 06f97ea to dc7cd90 Compare October 25, 2026 21:29
@wdcui
Weidong Cui (wdcui) added this pull request to the merge queue Oct 25, 2026
Merged via the queue into ulitebox with commit 4441da0 Oct 25, 2026
13 checks passed
@wdcui
Weidong Cui (wdcui) deleted the wdcui/ulitebox/proc-fd-links branch October 25, 2026 21:51
@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 FileResponse:HandlePath in /home/runner/work/litebox/litebox/litebox_broker_protocol/src/message.rs:780
  variant FileRequest:HandlePath in /home/runner/work/litebox/litebox/litebox_broker_protocol/src/message.rs:739

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