Merge pull request #310 from cakebaker/bump_nix

Bump nix & adapt to its API changes
This commit is contained in:
Sylvestre Ledru
2025-05-23 11:35:10 +02:00
committed by GitHub
4 changed files with 29 additions and 16 deletions

32
Cargo.lock generated
View File

@@ -345,7 +345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -472,7 +472,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.48.5", "windows-targets 0.52.6",
] ]
[[package]] [[package]]
@@ -540,6 +540,18 @@ name = "nix"
version = "0.29.0" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" 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 = [ dependencies = [
"bitflags", "bitflags",
"cfg-if", "cfg-if",
@@ -889,7 +901,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.4.15", "linux-raw-sys 0.4.15",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -902,7 +914,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.9.4", "linux-raw-sys 0.9.4",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -1052,7 +1064,7 @@ dependencies = [
"getrandom", "getrandom",
"once_cell", "once_cell",
"rustix 1.0.5", "rustix 1.0.5",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -1169,7 +1181,7 @@ dependencies = [
"clap_mangen", "clap_mangen",
"dns-lookup", "dns-lookup",
"libc", "libc",
"nix", "nix 0.30.1",
"phf", "phf",
"phf_codegen", "phf_codegen",
"pretty_assertions", "pretty_assertions",
@@ -1326,7 +1338,7 @@ name = "uu_mesg"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"clap", "clap",
"nix", "nix 0.30.1",
"uucore", "uucore",
] ]
@@ -1369,7 +1381,7 @@ name = "uu_uuidgen"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"clap", "clap",
"nix", "nix 0.30.1",
"rand 0.9.1", "rand 0.9.1",
"thiserror", "thiserror",
"uucore", "uucore",
@@ -1390,7 +1402,7 @@ dependencies = [
"glob", "glob",
"iana-time-zone", "iana-time-zone",
"libc", "libc",
"nix", "nix 0.29.0",
"number_prefix", "number_prefix",
"os_display", "os_display",
"time", "time",
@@ -1552,7 +1564,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]

View File

@@ -55,7 +55,7 @@ libc = "0.2.171"
libmount-sys = "0.1.1" libmount-sys = "0.1.1"
linux-raw-sys = { version = "0.9.0", features = ["ioctl"] } linux-raw-sys = { version = "0.9.0", features = ["ioctl"] }
md-5 = "0.10.6" md-5 = "0.10.6"
nix = { version = "0.29", default-features = false } nix = { version = "0.30", default-features = false }
phf = "0.11.2" phf = "0.11.2"
phf_codegen = "0.11.2" phf_codegen = "0.11.2"
rand = { version = "0.9.0", features = ["small_rng"] } rand = { version = "0.9.0", features = ["small_rng"] }

View File

@@ -12,5 +12,5 @@ path = "src/main.rs"
[dependencies] [dependencies]
clap = { workspace = true } clap = { workspace = true }
nix = { workspace = true } nix = { workspace = true, features = ["fs"] }
uucore = { workspace = true } uucore = { workspace = true }

View File

@@ -5,7 +5,7 @@
use clap::{builder::PossibleValuesParser, crate_version, Arg, ArgAction, ArgMatches, Command}; use clap::{builder::PossibleValuesParser, crate_version, Arg, ArgAction, ArgMatches, Command};
#[cfg(target_family = "unix")] #[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}; use uucore::{error::UResult, format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("mesg.md"); const ABOUT: &str = help_about!("mesg.md");
@@ -14,7 +14,7 @@ const USAGE: &str = help_usage!("mesg.md");
#[cfg(target_family = "unix")] #[cfg(target_family = "unix")]
pub fn do_mesg(matches: &ArgMatches) -> UResult<()> { pub fn do_mesg(matches: &ArgMatches) -> UResult<()> {
use nix::sys::stat::{fchmod, fstat, Mode}; use nix::sys::stat::{fchmod, fstat, Mode};
use std::{io, os::fd::AsRawFd}; use std::io;
use std::{io::IsTerminal, os::fd::AsFd}; use std::{io::IsTerminal, os::fd::AsFd};
for fd in &[ for fd in &[
@@ -23,7 +23,7 @@ pub fn do_mesg(matches: &ArgMatches) -> UResult<()> {
std::io::stderr().as_fd(), std::io::stderr().as_fd(),
] { ] {
if fd.is_terminal() { 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::<String>("enable") { if let Some(enable) = matches.get_one::<String>("enable") {
// 'mesg y' on the GNU version seems to only modify the group write bit, // 'mesg y' on the GNU version seems to only modify the group write bit,
// but 'mesg n' modifies both group and others write bits. // but 'mesg n' modifies both group and others write bits.
@@ -32,7 +32,8 @@ pub fn do_mesg(matches: &ArgMatches) -> UResult<()> {
} else { } else {
st.st_mode & !0o022 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" { if enable == "n" {
set_exit_code(1); set_exit_code(1);
} }