Skip to content

Commit aa5dd0e

Browse files
authored
Merge pull request #7971 from cakebaker/bump_nix_and_ctrlc
Bump `nix` & `ctrlc`, adapt code to API changes in `nix`
2 parents 3a05fa9 + 73e4472 commit aa5dd0e

File tree

12 files changed

+99
-93
lines changed

12 files changed

+99
-93
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ clap_mangen = "0.2"
289289
compare = "0.1.0"
290290
coz = { version = "0.1.3" }
291291
crossterm = "0.29.0"
292-
ctrlc = { version = "3.4.4", features = ["termination"] }
292+
ctrlc = { version = "3.4.7", features = ["termination"] }
293293
dns-lookup = { version = "2.0.4" }
294294
exacl = "0.12.0"
295295
file_diff = "1.0.0"
@@ -311,7 +311,7 @@ lscolors = { version = "0.20.0", default-features = false, features = [
311311
] }
312312
memchr = "2.7.2"
313313
memmap2 = "0.9.4"
314-
nix = { version = "0.29", default-features = false }
314+
nix = { version = "0.30", default-features = false }
315315
nom = "8.0.0"
316316
notify = { version = "=8.0.0", features = ["macos_kqueue"] }
317317
num-bigint = "0.4.4"

fuzz/Cargo.lock

Lines changed: 49 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uu/cat/src/cat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::io::{self, BufWriter, IsTerminal, Read, Write};
1010
#[cfg(unix)]
1111
use std::net::Shutdown;
1212
#[cfg(unix)]
13-
use std::os::fd::{AsFd, AsRawFd};
13+
use std::os::fd::AsFd;
1414
#[cfg(unix)]
1515
use std::os::unix::fs::FileTypeExt;
1616
#[cfg(unix)]
@@ -372,7 +372,7 @@ fn cat_handle<R: FdReadable>(
372372
#[cfg(unix)]
373373
fn is_appending() -> bool {
374374
let stdout = io::stdout();
375-
let Ok(flags) = fcntl(stdout.as_raw_fd(), FcntlArg::F_GETFL) else {
375+
let Ok(flags) = fcntl(stdout.as_fd(), FcntlArg::F_GETFL) else {
376376
return false;
377377
};
378378
// TODO Replace `1 << 10` with `nix::fcntl::Oflag::O_APPEND`.

src/uu/cat/src/splice.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
use super::{CatResult, FdReadable, InputHandle};
66

77
use nix::unistd;
8-
use std::os::{
9-
fd::AsFd,
10-
unix::io::{AsRawFd, RawFd},
11-
};
8+
use std::os::{fd::AsFd, unix::io::AsRawFd};
129

1310
use uucore::pipes::{pipe, splice, splice_exact};
1411

@@ -41,7 +38,7 @@ pub(super) fn write_fast_using_splice<R: FdReadable, S: AsRawFd + AsFd>(
4138
// we can recover by copying the data that we have from the
4239
// intermediate pipe to stdout using normal read/write. Then
4340
// we tell the caller to fall back.
44-
copy_exact(pipe_rd.as_raw_fd(), write_fd, n)?;
41+
copy_exact(&pipe_rd, write_fd, n)?;
4542
return Ok(true);
4643
}
4744
}
@@ -55,7 +52,7 @@ pub(super) fn write_fast_using_splice<R: FdReadable, S: AsRawFd + AsFd>(
5552
/// Move exactly `num_bytes` bytes from `read_fd` to `write_fd`.
5653
///
5754
/// Panics if not enough bytes can be read.
58-
fn copy_exact(read_fd: RawFd, write_fd: &impl AsFd, num_bytes: usize) -> nix::Result<()> {
55+
fn copy_exact(read_fd: &impl AsFd, write_fd: &impl AsFd, num_bytes: usize) -> nix::Result<()> {
5956
let mut left = num_bytes;
6057
let mut buf = [0; BUF_SIZE];
6158
while left > 0 {

src/uu/dd/src/dd.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ use std::ffi::OsString;
3131
use std::fs::{File, OpenOptions};
3232
use std::io::{self, Read, Seek, SeekFrom, Stdout, Write};
3333
#[cfg(any(target_os = "linux", target_os = "android"))]
34+
use std::os::fd::AsFd;
35+
#[cfg(any(target_os = "linux", target_os = "android"))]
3436
use std::os::unix::fs::OpenOptionsExt;
3537
#[cfg(unix)]
3638
use std::os::unix::{
@@ -279,7 +281,7 @@ impl Source {
279281
match self {
280282
Self::File(f) => {
281283
let advice = PosixFadviseAdvice::POSIX_FADV_DONTNEED;
282-
posix_fadvise(f.as_raw_fd(), offset, len, advice)
284+
posix_fadvise(f.as_fd(), offset, len, advice)
283285
}
284286
_ => Err(Errno::ESPIPE), // "Illegal seek"
285287
}
@@ -649,7 +651,7 @@ impl Dest {
649651
match self {
650652
Self::File(f, _) => {
651653
let advice = PosixFadviseAdvice::POSIX_FADV_DONTNEED;
652-
posix_fadvise(f.as_raw_fd(), offset, len, advice)
654+
posix_fadvise(f.as_fd(), offset, len, advice)
653655
}
654656
_ => Err(Errno::ESPIPE), // "Illegal seek"
655657
}
@@ -784,7 +786,7 @@ impl<'a> Output<'a> {
784786
#[cfg(any(target_os = "linux", target_os = "android"))]
785787
if let Some(libc_flags) = make_linux_oflags(&settings.oflags) {
786788
nix::fcntl::fcntl(
787-
fx.as_raw().as_raw_fd(),
789+
fx.as_raw().as_fd(),
788790
F_SETFL(OFlag::from_bits_retain(libc_flags)),
789791
)?;
790792
}

0 commit comments

Comments
 (0)