Skip to content

CICD.yml: Use unshare for run_df_with_masked_proc#12120

Open
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:patch-1
Open

CICD.yml: Use unshare for run_df_with_masked_proc#12120
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:patch-1

Conversation

@oech3
Copy link
Copy Markdown
Contributor

@oech3 oech3 commented May 2, 2026

Needed to run

/// Run df inside a mount namespace where /proc is masked with tmpfs.
/// Returns (success, stdout, stderr).
#[cfg(target_os = "linux")]
fn run_df_with_masked_proc(args: &str) -> Option<(bool, String, String)> {
use std::process::Command;
// Check if user namespaces are available
if !Command::new("unshare")
.args(["-rm", "true"])
.status()
.is_ok_and(|s| s.success())
{
return None;
}
let df_path = TestScenario::new("df").bin_path.clone();
let output = Command::new("unshare")
.args(["-rm", "sh", "-c"])
.arg(format!(
"mount -t tmpfs tmpfs /proc && {} df {args}",
df_path.display()
))
.output()
.ok()?;
Some((
output.status.success(),
String::from_utf8_lossy(&output.stdout).to_string(),
String::from_utf8_lossy(&output.stderr).to_string(),
))
}

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.
Congrats! The gnu test tests/printf/printf-surprise is now passing!
Note: The gnu test tests/env/env-signal-handler was skipped on 'main' but is now failing.

@oech3 oech3 marked this pull request as ready for review May 2, 2026 10:17
@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented May 2, 2026

Hmm... the test was already PASS without this. Does it always PASS when unshare is not available?

@cakebaker
Copy link
Copy Markdown
Contributor

@oech3 if unshare fails, None is returned on line 1107 in the snippet above. And based on that, the asserts in test_df_masked_proc_fallback are not run and so they can't fail.

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented May 2, 2026

@cakebaker
Copy link
Copy Markdown
Contributor

@oech3 I think it is not possible to do a skip at runtime.

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented May 2, 2026

So it is difficult verify this PR and add tests depending on unshare and strace...
rust-lang/rust#68007

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented May 3, 2026

@cakebaker We can catch regression if unshare succeed. Right? If so, I think it is worth to consider merging this.

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.

2 participants