Skip to content

fix(wayland): a process table glass cannot read is not an absent Xwayland - #525

Merged
xxx merged 4 commits into
masterfrom
fix/381-proc-scan-reports-could-not-look
Aug 25, 2026
Merged

fix(wayland): a process table glass cannot read is not an absent Xwayland#525
xxx merged 4 commits into
masterfrom
fix/381-proc-scan-reports-could-not-look

Conversation

@xxx

@xxx xxx commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #381.

session_display returned None for four different reasons and recover_if_due read all of them as the one that is expected — a native Wayland app with no X11 side. An unreadable /proc, or an unreadable environ/cmdline on the session's own Xwayland, switched lost-window recovery off for the life of the session with nothing said, after which list_windows reported the compositor's shorter list as fact.

The scans now separate "looked and found nothing" from "could not look". Ok(None) is the native Wayland session and nothing else; an Err is reported like a failed XProbe::connect. A read failure before the runtime-dir match stays a silent skip — that is what another user's Xwayland, or one that exited mid-scan, correctly looks like.

Recovery::warned records which step failed rather than that something did, so a /proc failure no longer consumes the line a later connect failure would have said (the same asymmetry, one branch over).

session_processes swallowed the same read_dir("/proc") failure, and doctor's leak accounting read the empty list as "the probe left nothing running" — deleting the probe's runtime dir out from under whatever still held sockets in it. It now reports that it could not tell, and keeps the dir. A failed scan is retried within the existing 500 ms LEAK_GRACE, since a host out of file descriptors is the transient that wait is there for.

Verification

  • 189 glass-wayland unit tests; 93 workspace test binaries; 0 failures.
  • cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check clean.
  • The #[ignore]d real-session tests pass against a live sway/Xwayland (--include-ignored).
  • The process table is a parameter to the scans, so the branches that decide whether recovery runs are covered against a built one: no /proc, an entry whose files cannot be read, an Xwayland with no :N argument, one serving another session, and a table whose only entry is unreadable.
  • Each new test was shown to fail by reinstating the swallow it guards (5 ablations).

xxx and others added 4 commits August 25, 2026 10:25
…land (fixes #381)

`session_display` returned `None` for four different reasons and
`recover_if_due` read all of them as the one that is expected — a native
Wayland app with no X11 side. An unreadable `/proc`, or an unreadable
`environ`/`cmdline` on the session's own Xwayland, switched lost-window
recovery off for the life of the session with nothing said, after which
`list_windows` reported the compositor's shorter list as fact.

The scans now separate "looked and found nothing" from "could not look":
`Ok(None)` is the native Wayland session and nothing else, and an `Err`
goes through the same warn-once path as a failed `XProbe::connect`. A read
failure before the runtime-dir match stays a silent skip — that is what
another user's Xwayland, or one that exited mid-scan, correctly looks like.

`session_processes` swallowed the same `read_dir("/proc")` failure, and
doctor's leak accounting read the empty list as "the probe left nothing
running" — deleting the probe's runtime dir out from under whatever still
held sockets in it. It now reports that it could not tell, and keeps the
dir.

The process table is a parameter to the scans, so the branches that decide
whether recovery runs are covered against a built one: no `/proc`, an entry
whose files cannot be read, an Xwayland with no display argument, and one
serving another session. Verified by ablation — reinstating each swallow
fails the tests that name it.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
… per session

Review of the previous commit: a `/proc` failure took the session's single
warning slot, after which a genuine `XProbe::connect` failure was silent —
the asymmetry #381 is about, one branch over. `warned` now records which
step failed, so a failure of a different kind is still said once, and the
read path no longer has to clear the flag by hand to get that.

Also from review: the pre-match skip is shown on a table whose only entry
is the unreadable one, so the answer cannot come from a second entry the
scan happened to reach first; the no-display error names what it rejected
(a screen- or host-qualified argument is not "no display argument"); the
`/proc` reads that stay silent say why; and the fixture no longer claims
CI runs as root, which it does not.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comments only — no code changed. The review-fix commit's new comments had
not been through the pass the first one had: each now carries its fact
without the sentence restating it (205 words to 142).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comments only. Run over the branch as a whole rather than per commit,
which is what surfaces a fact stated in two commits at once: the "survivor
glass cannot name" fact sat on `Leaked`, its `unknown` field and
`leak_notice`; "cannot be arranged in a real /proc" sat on the `PROC`
const, the fixture and the module doc; and three test docs restated the
pre/post-match rationale their code comments already carry.

Each now has one home; the tests name what they pin. 1474 words to 1282
across the changeset.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@xxx
xxx merged commit 1892bbe into master Aug 25, 2026
17 checks passed
@xxx
xxx deleted the fix/381-proc-scan-reports-could-not-look branch August 25, 2026 18:17
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.

wayland: a /proc read failure silently disables lost-window recovery for the session

1 participant