From da8cede6bb330fdfaa4d95066b8ef104b6b73bfd Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 23 May 2025 10:17:49 +0200 Subject: [PATCH 1/2] Bump nix from 0.29.0 to 0.30.1 --- Cargo.lock | 32 ++++++++++++++++++++++---------- Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d7527d..007bc3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -345,7 +345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -472,7 +472,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -540,6 +540,18 @@ name = "nix" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ "bitflags", "cfg-if", @@ -889,7 +901,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -902,7 +914,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1052,7 +1064,7 @@ dependencies = [ "getrandom", "once_cell", "rustix 1.0.5", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1169,7 +1181,7 @@ dependencies = [ "clap_mangen", "dns-lookup", "libc", - "nix", + "nix 0.30.1", "phf", "phf_codegen", "pretty_assertions", @@ -1326,7 +1338,7 @@ name = "uu_mesg" version = "0.0.1" dependencies = [ "clap", - "nix", + "nix 0.30.1", "uucore", ] @@ -1369,7 +1381,7 @@ name = "uu_uuidgen" version = "0.0.1" dependencies = [ "clap", - "nix", + "nix 0.30.1", "rand 0.9.1", "thiserror", "uucore", @@ -1390,7 +1402,7 @@ dependencies = [ "glob", "iana-time-zone", "libc", - "nix", + "nix 0.29.0", "number_prefix", "os_display", "time", @@ -1552,7 +1564,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3e38c23..3be8ae9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ libc = "0.2.171" libmount-sys = "0.1.1" linux-raw-sys = { version = "0.9.0", features = ["ioctl"] } md-5 = "0.10.6" -nix = { version = "0.29", default-features = false } +nix = { version = "0.30", default-features = false } phf = "0.11.2" phf_codegen = "0.11.2" rand = { version = "0.9.0", features = ["small_rng"] } From 184b2c8f1e55846bba72a1f0506bdaafab9a3264 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 23 May 2025 10:52:10 +0200 Subject: [PATCH 2/2] mesg: adapt to API changes in nix --- src/uu/mesg/Cargo.toml | 2 +- src/uu/mesg/src/mesg.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uu/mesg/Cargo.toml b/src/uu/mesg/Cargo.toml index c75a4d8..382e99c 100644 --- a/src/uu/mesg/Cargo.toml +++ b/src/uu/mesg/Cargo.toml @@ -12,5 +12,5 @@ path = "src/main.rs" [dependencies] clap = { workspace = true } -nix = { workspace = true } +nix = { workspace = true, features = ["fs"] } uucore = { workspace = true } diff --git a/src/uu/mesg/src/mesg.rs b/src/uu/mesg/src/mesg.rs index 220ed36..4859581 100644 --- a/src/uu/mesg/src/mesg.rs +++ b/src/uu/mesg/src/mesg.rs @@ -5,7 +5,7 @@ use clap::{builder::PossibleValuesParser, crate_version, Arg, ArgAction, ArgMatches, Command}; #[cfg(target_family = "unix")] -use uucore::error::{set_exit_code, UIoError}; +use uucore::error::{set_exit_code, UIoError, USimpleError}; use uucore::{error::UResult, format_usage, help_about, help_usage}; const ABOUT: &str = help_about!("mesg.md"); @@ -14,7 +14,7 @@ const USAGE: &str = help_usage!("mesg.md"); #[cfg(target_family = "unix")] pub fn do_mesg(matches: &ArgMatches) -> UResult<()> { use nix::sys::stat::{fchmod, fstat, Mode}; - use std::{io, os::fd::AsRawFd}; + use std::io; use std::{io::IsTerminal, os::fd::AsFd}; for fd in &[ @@ -23,7 +23,7 @@ pub fn do_mesg(matches: &ArgMatches) -> UResult<()> { std::io::stderr().as_fd(), ] { if fd.is_terminal() { - let st = fstat(fd.as_raw_fd())?; + let st = fstat(fd.as_fd()).map_err(|e| USimpleError::new(1, e.desc()))?; if let Some(enable) = matches.get_one::("enable") { // 'mesg y' on the GNU version seems to only modify the group write bit, // but 'mesg n' modifies both group and others write bits. @@ -32,7 +32,8 @@ pub fn do_mesg(matches: &ArgMatches) -> UResult<()> { } else { st.st_mode & !0o022 }; - fchmod(fd.as_raw_fd(), Mode::from_bits_retain(new_mode))?; + fchmod(fd.as_fd(), Mode::from_bits_retain(new_mode)) + .map_err(|e| USimpleError::new(1, e.desc()))?; if enable == "n" { set_exit_code(1); }