diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea378a0b..598da3c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -362,7 +362,7 @@ jobs: include: - build: msrv os: ubuntu-latest - rust: 1.58 + rust: 1.63 steps: - uses: actions/checkout@v3 diff --git a/Cargo.toml b/Cargo.toml index 796151b7..f4bce490 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ edition = "2018" publish = false exclude = ["/.*"] # This is also checked in CI. -rust-version = "1.56" +rust-version = "1.63" [dev-dependencies] #async-std = { version = "1.10.0", features = ["attributes"] } @@ -30,10 +30,10 @@ rand = "0.8.1" tempfile = "3.1.0" camino = "1.0.5" libc = "0.2.100" -io-lifetimes = "1.0.0" +io-lifetimes = "2.0.0" [target.'cfg(not(windows))'.dev-dependencies] -rustix = { version = "0.37.9", features = ["fs"] } +rustix = { version = "0.38.0", features = ["fs"] } [target.'cfg(windows)'.dev-dependencies] # nt_version uses internal Windows APIs, however we're only using it diff --git a/README.md b/README.md index 9972daa8..dcecbf7f 100644 --- a/README.md +++ b/README.md @@ -243,7 +243,7 @@ the process filesystem namespace. ## Minimum Supported Rust Version (MSRV) -This crate currently works on Rust 1.58, when default features are enabled. +This crate currently works on Rust 1.63, when default features are enabled. Some of the optional features have stricter requirements. [`arf-strings`]: https://github.com/bytecodealliance/arf-strings/ diff --git a/cap-async-std/Cargo.toml b/cap-async-std/Cargo.toml index 98a86a3c..786f91fa 100644 --- a/cap-async-std/Cargo.toml +++ b/cap-async-std/Cargo.toml @@ -18,12 +18,12 @@ arf-strings = { version = "0.7.0", optional = true } # Enable "unstable" for `spawn_blocking`. async-std = { version = "1.10.0", features = ["attributes", "unstable"] } cap-primitives = { path = "../cap-primitives", version = "^0.25.0" } -io-lifetimes = { version = "1.0.0", default-features = false, features = ["async-std"] } +io-lifetimes = { version = "2.0.0", default-features = false, features = ["async-std"] } io-extras = { version = "0.17.0", features = ["use_async_std"] } camino = { version = "1.0.5", optional = true } [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.37.9", features = ["fs"] } +rustix = { version = "0.38.0", features = ["fs"] } [features] default = [] diff --git a/cap-directories/Cargo.toml b/cap-directories/Cargo.toml index 320b5112..6d2fb78c 100644 --- a/cap-directories/Cargo.toml +++ b/cap-directories/Cargo.toml @@ -17,7 +17,7 @@ cap-std = { path = "../cap-std", version = "^1.0.15" } directories-next = "2.0.0" [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.37.9" } +rustix = { version = "0.38.0" } [target.'cfg(windows)'.dependencies.windows-sys] version = "0.48.0" diff --git a/cap-fs-ext/Cargo.toml b/cap-fs-ext/Cargo.toml index c740afcf..d5c3a685 100644 --- a/cap-fs-ext/Cargo.toml +++ b/cap-fs-ext/Cargo.toml @@ -17,7 +17,7 @@ arf-strings = { version = "0.7.0", optional = true } #cap-async-std = { path = "../cap-async-std", optional = true, version = "^0.25.0" } cap-std = { path = "../cap-std", optional = true, version = "^1.0.15" } cap-primitives = { path = "../cap-primitives", version = "^1.0.15" } -io-lifetimes = { version = "1.0.0", default-features = false } +io-lifetimes = { version = "2.0.0", default-features = false } # Enable "unstable" for `spawn_blocking`. #async-std = { version = "1.10.0", features = ["attributes", "unstable"], optional = true } #async-trait = { version = "0.1.42", optional = true } diff --git a/cap-net-ext/Cargo.toml b/cap-net-ext/Cargo.toml index 9b69b9f0..f8d10648 100644 --- a/cap-net-ext/Cargo.toml +++ b/cap-net-ext/Cargo.toml @@ -15,5 +15,5 @@ edition = "2018" [dependencies] cap-std = { path = "../cap-std", version = "^1.0.15" } cap-primitives = { path = "../cap-primitives", version = "^1.0.15" } -rustix = { version = "0.37.9", features = ["net"] } +rustix = { version = "0.38.0", features = ["net"] } smallvec = "1.10" diff --git a/cap-net-ext/src/lib.rs b/cap-net-ext/src/lib.rs index c5760bd3..2166f66b 100644 --- a/cap-net-ext/src/lib.rs +++ b/cap-net-ext/src/lib.rs @@ -632,7 +632,7 @@ fn socket( address_family.into(), socket_type, socket_flags(blocking), - rustix::net::Protocol::default(), + None, )?; // Set the desired flags if we couldn't set them at creation. diff --git a/cap-primitives/Cargo.toml b/cap-primitives/Cargo.toml index 4350002f..4a75116b 100644 --- a/cap-primitives/Cargo.toml +++ b/cap-primitives/Cargo.toml @@ -17,18 +17,18 @@ ambient-authority = "0.0.2" arbitrary = { version = "1.0.0", optional = true, features = ["derive"] } ipnet = "2.3.0" maybe-owned = "0.3.4" -fs-set-times = "0.19.0" -io-extras = "0.17.0" -io-lifetimes = { version = "1.0.0", default-features = false } +fs-set-times = "0.20.0" +io-extras = "0.18.0" +io-lifetimes = { version = "2.0.0", default-features = false } [dev-dependencies] cap-tempfile = { path = "../cap-tempfile" } [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.37.9", features = ["fs", "process", "procfs", "termios", "time"] } +rustix = { version = "0.38.0", features = ["fs", "process", "procfs", "termios", "time"] } [target.'cfg(windows)'.dependencies] -winx = "0.35.0" +winx = "0.36.0" [target.'cfg(windows)'.dependencies.windows-sys] version = "0.48.0" diff --git a/cap-primitives/src/rustix/fs/open_unchecked.rs b/cap-primitives/src/rustix/fs/open_unchecked.rs index 4112a5a3..8ff6b351 100644 --- a/cap-primitives/src/rustix/fs/open_unchecked.rs +++ b/cap-primitives/src/rustix/fs/open_unchecked.rs @@ -2,7 +2,7 @@ use super::compute_oflags; use crate::fs::{stat_unchecked, OpenOptions, OpenUncheckedError}; use crate::AmbientAuthority; use io_lifetimes::AsFilelike; -use rustix::fs::{cwd, openat, Mode}; +use rustix::fs::{openat, Mode, CWD}; use rustix::io; use std::fs; use std::path::Path; @@ -67,5 +67,5 @@ pub(crate) fn open_ambient_impl( ambient_authority: AmbientAuthority, ) -> Result { let _ = ambient_authority; - open_unchecked(&cwd().as_filelike_view::(), path, options) + open_unchecked(&CWD.as_filelike_view::(), path, options) } diff --git a/cap-primitives/src/rustix/fs/reopen_impl.rs b/cap-primitives/src/rustix/fs/reopen_impl.rs index 40490a6b..e010a4d3 100644 --- a/cap-primitives/src/rustix/fs/reopen_impl.rs +++ b/cap-primitives/src/rustix/fs/reopen_impl.rs @@ -1,14 +1,14 @@ use crate::fs::{open_unchecked, OpenOptions}; use crate::rustix::fs::file_path; use io_lifetimes::AsFilelike; -use rustix::fs::cwd; +use rustix::fs::CWD; use std::{fs, io}; /// Implementation of `reopen`. pub(crate) fn reopen_impl(file: &fs::File, options: &OpenOptions) -> io::Result { if let Some(path) = file_path(file) { Ok(open_unchecked( - &cwd().as_filelike_view::(), + &CWD.as_filelike_view::(), &path, options, )?) diff --git a/cap-primitives/src/rustix/fs/stat_unchecked.rs b/cap-primitives/src/rustix/fs/stat_unchecked.rs index 076ce46e..6c35bd3f 100644 --- a/cap-primitives/src/rustix/fs/stat_unchecked.rs +++ b/cap-primitives/src/rustix/fs/stat_unchecked.rs @@ -60,7 +60,7 @@ pub(crate) fn stat_unchecked( // the current working directory returns a similar error, // then stop using `statx`. if let Err(rustix::io::Errno::PERM) = statx( - rustix::fs::cwd(), + rustix::fs::CWD, "", AtFlags::EMPTY_PATH, StatxFlags::empty(), diff --git a/cap-primitives/src/rustix/linux/fs/procfs.rs b/cap-primitives/src/rustix/linux/fs/procfs.rs index d6a68fd5..15922a06 100644 --- a/cap-primitives/src/rustix/linux/fs/procfs.rs +++ b/cap-primitives/src/rustix/linux/fs/procfs.rs @@ -10,9 +10,9 @@ use crate::fs::{ errors, open, read_link_unchecked, set_times_follow_unchecked, OpenOptions, SystemTimeSpec, }; use io_lifetimes::{AsFd, AsFilelike}; -use rustix::fs::{chmodat, Mode, OFlags, RawMode}; -use rustix::io::proc_self_fd; +use rustix::fs::{chmodat, AtFlags, Mode, OFlags, RawMode}; use rustix::path::DecInt; +use rustix::procfs::proc_self_fd; use std::os::unix::fs::{OpenOptionsExt, PermissionsExt}; use std::path::{Path, PathBuf}; use std::{fs, io}; @@ -46,7 +46,12 @@ pub(crate) fn set_permissions_through_proc_self_fd( let dirfd = proc_self_fd()?; let mode = Mode::from_bits(perm.mode() as RawMode).ok_or_else(errors::invalid_flags)?; - Ok(chmodat(dirfd, DecInt::from_fd(&opath), mode)?) + Ok(chmodat( + dirfd, + DecInt::from_fd(&opath), + mode, + AtFlags::empty(), + )?) } pub(crate) fn set_times_through_proc_self_fd( diff --git a/cap-std/Cargo.toml b/cap-std/Cargo.toml index 36c81b2f..75e3d14b 100644 --- a/cap-std/Cargo.toml +++ b/cap-std/Cargo.toml @@ -19,12 +19,12 @@ rustdoc-args = ["--cfg=doc_cfg"] [dependencies] arf-strings = { version = "0.7.0", optional = true } cap-primitives = { path = "../cap-primitives", version = "^1.0.15" } -io-extras = "0.17.0" -io-lifetimes = { version = "1.0.0", default-features = false } +io-extras = "0.18.0" +io-lifetimes = { version = "2.0.0", default-features = false } camino = { version = "1.0.5", optional = true } [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.37.9", features = ["fs"] } +rustix = { version = "0.38.0", features = ["fs"] } [features] default = [] diff --git a/cap-tempfile/Cargo.toml b/cap-tempfile/Cargo.toml index 3bafaea8..f1d04dfc 100644 --- a/cap-tempfile/Cargo.toml +++ b/cap-tempfile/Cargo.toml @@ -21,7 +21,7 @@ camino = { version = "1.0.5", optional = true } rand = "0.8.1" [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.37.9", features = ["procfs"] } +rustix = { version = "0.38.0", features = ["procfs"] } [target.'cfg(windows)'.dev-dependencies.windows-sys] version = "0.48.0" diff --git a/cap-tempfile/src/tempfile.rs b/cap-tempfile/src/tempfile.rs index 457e471c..ecda17b8 100644 --- a/cap-tempfile/src/tempfile.rs +++ b/cap-tempfile/src/tempfile.rs @@ -88,7 +88,7 @@ fn new_tempfile_linux(d: &Dir, anonymous: bool) -> io::Result> { fn generate_name_in(subdir: &Dir, f: &File) -> io::Result { use rustix::fd::AsFd; use rustix::fs::AtFlags; - let procself_fd = rustix::io::proc_self_fd()?; + let procself_fd = rustix::procfs::proc_self_fd()?; let fdnum = rustix::path::DecInt::from_fd(f.as_fd()); let fdnum = fdnum.as_c_str(); super::retry_with_name_ignoring(io::ErrorKind::AlreadyExists, |name| { diff --git a/cap-time-ext/Cargo.toml b/cap-time-ext/Cargo.toml index 10688807..19299e8e 100644 --- a/cap-time-ext/Cargo.toml +++ b/cap-time-ext/Cargo.toml @@ -17,7 +17,7 @@ cap-primitives = { path = "../cap-primitives", version = "^1.0.15" } cap-std = { path = "../cap-std", optional = true, version = "^1.0.15" } [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.37.9", features = ["time"] } +rustix = { version = "0.38.0", features = ["time"] } [target.'cfg(windows)'.dependencies] once_cell = "1.5.2" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 1532f929..642e41f9 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -15,7 +15,7 @@ cap-primitives = { path = "../cap-primitives", features = ["arbitrary"] } # Depend on io-lifetimes with default features, as the fuzzing framework # seems to add a dependency on `io_lifetimes::OwnedFd::drop` even when the # code itself doesn't have one. -io-lifetimes = "1.0.0" +io-lifetimes = "2.0.0" [[bin]] name = "cap-primitives" diff --git a/tests/dir-ext.rs b/tests/dir-ext.rs index d5bf4996..0b0f5d91 100644 --- a/tests/dir-ext.rs +++ b/tests/dir-ext.rs @@ -39,8 +39,9 @@ fn remove_symlink_to_dir() { } let tempdir = TempDir::new(ambient_authority()).expect("create tempdir"); - let target = tempdir.create_dir("target").expect("create target dir"); - drop(target); + { + let _target = tempdir.create_dir("target").expect("create target dir"); + } tempdir.symlink("target", "link").expect("create symlink"); assert!(tempdir.exists("link"), "link exists"); tempdir @@ -53,8 +54,9 @@ fn remove_symlink_to_dir() { #[test] fn do_not_remove_dir() { let tempdir = TempDir::new(ambient_authority()).expect("create tempdir"); - let subdir = tempdir.create_dir("subdir").expect("create dir"); - drop(subdir); + { + let _subdir = tempdir.create_dir("subdir").expect("create dir"); + } assert!(tempdir.exists("subdir"), "subdir created"); tempdir .remove_file_or_symlink("subdir")