From 0a95417ef86d104dde0f819df3a4de6480e10041 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 18 Jan 2024 11:51:47 -0500 Subject: [PATCH] Update to cap-std 3, bump to 4 Adapt to the changes in that crate, xref https://github.com/bytecodealliance/cap-std/pull/343 --- Cargo.toml | 6 +++--- src/dirext.rs | 4 ++-- tests/it/main.rs | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 08fb388..0a80283 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,11 +8,11 @@ name = "cap-std-ext" readme = "README.md" repository = "https://github.com/coreos/cap-std-ext" # For historical reasons, the major version number is one greater than the cap-std major. -version = "3.0.1" +version = "4.0.0" [dependencies] -cap-tempfile = "2" -cap-primitives = "2" +cap-tempfile = "3" +cap-primitives = "3" [target.'cfg(not(windows))'.dependencies] rustix = { version = "0.38", features = ["fs", "procfs", "process", "pipe"] } diff --git a/src/dirext.rs b/src/dirext.rs index 8a0f471..0bfe5d5 100644 --- a/src/dirext.rs +++ b/src/dirext.rs @@ -71,7 +71,7 @@ pub trait CapStdExtDirExt { /// somedir.atomic_replace_with("somefilename", |f| -> io::Result<_> { /// f.write_all(contents)?; /// f.flush()?; - /// use std::os::unix::prelude::PermissionsExt; + /// use cap_std::fs::PermissionsExt; /// let perms = cap_std::fs::Permissions::from_mode(0o600); /// f.get_mut().as_file_mut().set_permissions(perms)?; /// Ok(()) @@ -276,7 +276,7 @@ impl CapStdExtDirExt for Dir { // secret data. #[cfg(unix)] { - use std::os::unix::prelude::PermissionsExt; + use cap_std::fs::PermissionsExt; let perms = cap_std::fs::Permissions::from_mode(0o600); f.get_mut().as_file_mut().set_permissions(perms)?; } diff --git a/tests/it/main.rs b/tests/it/main.rs index 0a8fea7..1b9ad0e 100644 --- a/tests/it/main.rs +++ b/tests/it/main.rs @@ -1,11 +1,10 @@ use anyhow::Result; -use cap_std::fs::{Dir, File, Permissions}; +use cap_std::fs::{Dir, File, Permissions, PermissionsExt}; use cap_std_ext::cap_std; use cap_std_ext::cmdext::CapStdExtCommandExt; use cap_std_ext::dirext::CapStdExtDirExt; use std::io::Write; -use std::os::unix::prelude::PermissionsExt; use std::path::Path; use std::{process::Command, sync::Arc};