aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Krasnoff <andrew.krasnoff@toptal.com>2026-07-29 00:20:58 +0200
committerGitHub <noreply@github.com>2026-07-29 01:20:58 +0300
commita0a6e13f1118ad3db52d4c851eefbcca7756e5e8 (patch)
tree0d4ec8dc712a05c6017403266cb348a9074eab5d
parente27a4ea427c9ed6248c0ee80570e94ed7b1928bd (diff)
fix: count ptmx master fds under devpts layouts (#1984)
live_server_holds_one_pty_master_fd_per_pane counted only /proc/<pid>/fd links resolving to exactly /dev/ptmx. On devpts setups such as WSL2 and many containers, a PTY master fd resolves to /dev/pts/ptmx instead, so the test found zero masters and failed with "had 0 ptmx master fds; expected 1" even though the server held the pane's master fd. Match both ptmx node paths; pty slaves still resolve to /dev/pts/<N> and stay uncounted, so the one-master-per-pane invariant is unchanged.
-rw-r--r--tests/live_handoff.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/live_handoff.rs b/tests/live_handoff.rs
index 4d81246a..832079e8 100644
--- a/tests/live_handoff.rs
+++ b/tests/live_handoff.rs
@@ -414,7 +414,8 @@ fn server_ptmx_fd_count(pid: u32) -> usize {
entries
.filter_map(Result::ok)
.filter_map(|entry| fs::read_link(entry.path()).ok())
- .filter(|target| target == Path::new("/dev/ptmx"))
+ // ptmx master node: /dev/ptmx or /dev/pts/ptmx (devpts); slaves /dev/pts/<N> excluded.
+ .filter(|target| target == Path::new("/dev/ptmx") || target == Path::new("/dev/pts/ptmx"))
.count()
}
@@ -443,7 +444,7 @@ fn wait_for_server_ptmx_fd_count(pid: u32, expected: usize, timeout: Duration) {
}
thread::sleep(Duration::from_millis(25));
}
- panic!("server pid {pid} had {last_count} /dev/ptmx fds; expected {expected}");
+ panic!("server pid {pid} had {last_count} ptmx master fds; expected {expected}");
}
#[cfg(target_os = "linux")]