From 7c44740d9f866a0b32f66a0fb4ce4f19b9bcca00 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Fri, 11 Sep 2026 22:22:36 +0200 Subject: [PATCH] Skip the read-only-directory test where modes are not enforced `a_failed_overwrite_puts_the_original_back` makes the presets directory read-only and expects the overwrite to fail. CI's Desktop job runs in a container as root, and root is not refused by a mode: the write succeeds, the assertion fails, and build-and-test has been red on every push to master since the test arrived. The test now probes the refusal it depends on -- one write into the directory it just locked -- and skips where that write goes through. Probed rather than keyed on the uid, because what the test needs is the refusal itself, and a filesystem mounted without permission checks would pass a uid test and fail this one all the same. --- ui/dr-ui/src/presets.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/dr-ui/src/presets.rs b/ui/dr-ui/src/presets.rs index 187cf43..8df9507 100644 --- a/ui/dr-ui/src/presets.rs +++ b/ui/dr-ui/src/presets.rs @@ -1608,6 +1608,22 @@ mod tests { perms.set_mode(0o500); std::fs::set_permissions(&dir, perms.clone()).unwrap(); + // Root is not refused by a mode, and CI's desktop job runs as root + // inside its container: there the directory is as writable as it ever + // was and the "failed" write succeeds. Probed rather than assumed from + // the uid, because what the test needs is the refusal itself, and a + // filesystem mounted without permission checks would pass the uid + // test and fail this one all the same. + let probe = dir.join("probe"); + let enforced = std::fs::write(&probe, b"").is_err(); + if !enforced { + let _ = std::fs::remove_file(&probe); + perms.set_mode(0o700); + std::fs::set_permissions(&dir, perms).unwrap(); + eprintln!("directory modes are not enforced here (root?); skipping"); + return; + } + let failed = presets.insert("Warm", Preset::default()).is_err(); // Restore the permissions before asserting, so a failure here does not