os-rust/tests/run-make/issue-107495-archive-permissions/rmake.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
549 B
Rust
Raw Permalink Normal View History

#![feature(rustc_private)]
#[cfg(unix)]
extern crate libc;
2024-03-19 10:04:32 +00:00
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
use std::path::Path;
2024-07-17 13:31:38 +00:00
use run_make_support::{aux_build, rfs};
2024-03-19 10:04:32 +00:00
fn main() {
#[cfg(unix)]
unsafe {
libc::umask(0o002);
}
2024-03-19 10:04:32 +00:00
aux_build().arg("foo.rs").run();
verify(Path::new("libfoo.rlib"));
2024-03-19 10:04:32 +00:00
}
fn verify(path: &Path) {
let perm = rfs::metadata(path).permissions();
2024-03-19 10:04:32 +00:00
assert!(!perm.readonly());
// Check that the file is readable for everyone
#[cfg(unix)]
assert_eq!(perm.mode(), 0o100664);
}