forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#122723 - bjorn3:archive_writer_fixes, r=nne…
…thercote Use same file permissions for ar_archive_writer as the LLVM archive writer This is required to switch to ar_archive_writer in the future without regressions. In addition to this PR support for reading thin archives needs to be added (rust-lang#107407) to fix all known regressions. Fixes rust-lang#107495
- Loading branch information
Showing
3 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#![feature(rustc_private)] | ||
|
||
#[cfg(unix)] | ||
extern crate libc; | ||
extern crate run_make_support; | ||
|
||
use run_make_support::{aux_build, tmp_dir}; | ||
use std::fs; | ||
#[cfg(unix)] | ||
use std::os::unix::fs::PermissionsExt; | ||
use std::path::Path; | ||
|
||
fn main() { | ||
#[cfg(unix)] | ||
unsafe { | ||
libc::umask(0o002); | ||
} | ||
|
||
aux_build().arg("foo.rs").run(); | ||
verify(&tmp_dir().join("libfoo.rlib")); | ||
} | ||
|
||
fn verify(path: &Path) { | ||
let perm = fs::metadata(path).unwrap().permissions(); | ||
|
||
assert!(!perm.readonly()); | ||
|
||
// Check that the file is readable for everyone | ||
#[cfg(unix)] | ||
assert_eq!(perm.mode(), 0o100664); | ||
} |