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