tests/inst: Drop nix dependency
It has various semver bumps and we were literally just using it to duplicate what's already in `libc`.
This commit is contained in:
parent
180a1d8f0a
commit
c0beedbb48
|
|
@ -29,12 +29,12 @@ futures = "0.3.4"
|
||||||
http = "0.2.0"
|
http = "0.2.0"
|
||||||
tokio = { version = "1.4.0", features = ["full"] }
|
tokio = { version = "1.4.0", features = ["full"] }
|
||||||
futures-util = "0.3.1"
|
futures-util = "0.3.1"
|
||||||
|
libc = "0.2.100"
|
||||||
base64 = "0.12.0"
|
base64 = "0.12.0"
|
||||||
procspawn = "0.8"
|
procspawn = "0.8"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
strum = "0.18.0"
|
strum = "0.18.0"
|
||||||
strum_macros = "0.18.0"
|
strum_macros = "0.18.0"
|
||||||
nix = "0.23.0"
|
|
||||||
# See discussion in https://github.com/coreos/rpm-ostree/pull/2569#issuecomment-780569188
|
# See discussion in https://github.com/coreos/rpm-ostree/pull/2569#issuecomment-780569188
|
||||||
rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", tag = "v2021.3" }
|
rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", tag = "v2021.3" }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,6 @@ pub(crate) fn itest_tmpfiles() -> Result<()> {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let metadata = Path::new("/run/ostree").metadata()?;
|
let metadata = Path::new("/run/ostree").metadata()?;
|
||||||
assert_eq!(metadata.permissions().mode() & !nix::libc::S_IFMT, 0o755);
|
assert_eq!(metadata.permissions().mode() & !libc::S_IFMT, 0o755);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,6 @@ pub(crate) fn mutate_one_executable_to(
|
||||||
|
|
||||||
/// Find ELF files in the srcdir, write new copies to dest (only percentage)
|
/// Find ELF files in the srcdir, write new copies to dest (only percentage)
|
||||||
pub(crate) fn mutate_executables_to(src: &Dir, dest: &Dir, percentage: u32) -> Result<u32> {
|
pub(crate) fn mutate_executables_to(src: &Dir, dest: &Dir, percentage: u32) -> Result<u32> {
|
||||||
use nix::sys::stat::Mode as NixMode;
|
|
||||||
assert!(percentage > 0 && percentage <= 100);
|
assert!(percentage > 0 && percentage <= 100);
|
||||||
let mut mutated = 0;
|
let mut mutated = 0;
|
||||||
for entry in src.entries()? {
|
for entry in src.entries()? {
|
||||||
|
|
@ -84,13 +83,13 @@ pub(crate) fn mutate_executables_to(src: &Dir, dest: &Dir, percentage: u32) -> R
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let meta = entry.metadata()?;
|
let meta = entry.metadata()?;
|
||||||
let mode = NixMode::from_bits_truncate(meta.mode());
|
let mode = meta.mode();
|
||||||
// Must be executable
|
// Must be executable
|
||||||
if !mode.intersects(NixMode::S_IXUSR | NixMode::S_IXGRP | NixMode::S_IXOTH) {
|
if mode & (libc::S_IXUSR | libc::S_IXGRP | libc::S_IXOTH) == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Not suid
|
// Not suid
|
||||||
if mode.intersects(NixMode::S_ISUID | NixMode::S_ISGID) {
|
if mode & (libc::S_ISUID | libc::S_ISGID) == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Greater than 1k in size
|
// Greater than 1k in size
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue