From 5bc4ecd86884761f881bb802af4665c5f32dfb6f Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Sat, 31 Oct 2026 10:17:21 -0700 Subject: [PATCH] procfs: make the hidden-batch dirent test order independent The test asserted that an unfiltered second read returns nothing, which only holds when "visible" is the last entry the directory yields. It passed on ubuntu-24.04 runners and fails on every ubuntu-26.04 job, where "visible" evidently precedes a dot entry: the first read then correctly stops at "visible" and the second returns what is left. Re-read with the same filter instead: the kept entry must not come back, and whichever order the filesystem uses, one of the two reads has to skip hidden single-entry batches to get there. Signed-off-by: Cong Wang --- crates/sandlock-core/src/procfs.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/sandlock-core/src/procfs.rs b/crates/sandlock-core/src/procfs.rs index 628b4683..3e794f03 100644 --- a/crates/sandlock-core/src/procfs.rs +++ b/crates/sandlock-core/src/procfs.rs @@ -2127,9 +2127,13 @@ mod tests { read_filtered_dirents(fd.as_raw_fd(), nr, 32, |name| name == "visible").unwrap(); let start = if nr == libc::SYS_getdents64 { 19 } else { 18 }; assert_eq!(&data[start..start + 8], b"visible\0"); - assert!(read_filtered_dirents(fd.as_raw_fd(), nr, 32, |_| true) - .unwrap() - .is_empty()); + // The dots may come before or after "visible", so only the kept + // entry's absence is order independent. + assert!( + read_filtered_dirents(fd.as_raw_fd(), nr, 32, |name| name == "visible") + .unwrap() + .is_empty() + ); } }