Skip to content

Commit

Permalink
Drop gvariant dependency
Browse files Browse the repository at this point in the history
It isn't an actively maintained crate and our usage is tiny
and not performance sensitive enough to warrant the zero-copy
it entails.

Just motivated by doing a pass over our dependencies.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Oct 15, 2024
1 parent 2d0512c commit abf7eae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ clap_mangen = { version = "0.2.20", optional = true }
cap-std-ext = { workspace = true, features = ["fs_utf8"] }
hex = "^0.4.3"
fn-error-context = { workspace = true }
gvariant = "0.5.0"
indicatif = "0.17.8"
libc = { workspace = true }
liboverdrop = "0.1.0"
Expand Down
14 changes: 6 additions & 8 deletions lib/src/lsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ use cap_std_ext::cap_std::fs::{Metadata, MetadataExt};
#[cfg(feature = "install")]
use cap_std_ext::dirext::CapStdExtDirExt;
use fn_error_context::context;
#[cfg(feature = "install")]
use gvariant::{aligned_bytes::TryAsAligned, Marker, Structure};
use ostree_ext::gio;
use ostree_ext::ostree;
use rustix::fd::AsFd;
Expand Down Expand Up @@ -177,12 +175,12 @@ pub(crate) fn selinux_set_permissive(permissive: bool) -> Result<()> {
#[cfg(feature = "install")]
/// Check if the ostree-formatted extended attributes include a security.selinux value.
pub(crate) fn xattrs_have_selinux(xattrs: &ostree::glib::Variant) -> bool {
let v = xattrs.data_as_bytes();
let v = v.try_as_aligned().unwrap();
let v = gvariant::gv!("a(ayay)").cast(v);
for xattr in v.iter() {
let k = xattr.to_tuple().0;
if k == SELINUX_XATTR {
let n = xattrs.n_children();
for i in 0..n {
let child = xattrs.child_value(i);
let key = child.child_value(0);
let key = key.data_as_bytes();
if key == SELINUX_XATTR {
return true;
}
}
Expand Down

0 comments on commit abf7eae

Please sign in to comment.