mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 15:22:38 +00:00
Merge pull request #6055 from cakebaker/bump_nix
Bump nix from 0.27 to 0.28 & fix issues due to API changes
This commit is contained in:
commit
9de409de97
6 changed files with 24 additions and 26 deletions
17
Cargo.lock
generated
17
Cargo.lock
generated
|
@ -236,6 +236,12 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.35"
|
||||
|
@ -673,12 +679,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
version = "3.4.1"
|
||||
version = "3.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82e95fbd621905b854affdc67943b043a0fbb6ed7385fd5a25650d19a8a6cfdf"
|
||||
checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1303,12 +1309,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.27.1"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
|
||||
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ lscolors = { version = "0.16.0", default-features = false, features = [
|
|||
] }
|
||||
memchr = "2"
|
||||
memmap2 = "0.9"
|
||||
nix = { version = "0.27", default-features = false }
|
||||
nix = { version = "0.28", default-features = false }
|
||||
nom = "7.1.3"
|
||||
notify = { version = "=6.0.1", features = ["macos_kqueue"] }
|
||||
num-bigint = "0.4.4"
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
use super::{CatResult, FdReadable, InputHandle};
|
||||
|
||||
use nix::unistd;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::os::{
|
||||
fd::AsFd,
|
||||
unix::io::{AsRawFd, RawFd},
|
||||
};
|
||||
|
||||
use uucore::pipes::{pipe, splice, splice_exact};
|
||||
|
||||
|
@ -20,9 +23,9 @@ const BUF_SIZE: usize = 1024 * 16;
|
|||
/// The `bool` in the result value indicates if we need to fall back to normal
|
||||
/// copying or not. False means we don't have to.
|
||||
#[inline]
|
||||
pub(super) fn write_fast_using_splice<R: FdReadable>(
|
||||
pub(super) fn write_fast_using_splice<R: FdReadable, S: AsRawFd + AsFd>(
|
||||
handle: &InputHandle<R>,
|
||||
write_fd: &impl AsRawFd,
|
||||
write_fd: &S,
|
||||
) -> CatResult<bool> {
|
||||
let (pipe_rd, pipe_wr) = pipe()?;
|
||||
|
||||
|
@ -38,7 +41,7 @@ pub(super) fn write_fast_using_splice<R: FdReadable>(
|
|||
// we can recover by copying the data that we have from the
|
||||
// intermediate pipe to stdout using normal read/write. Then
|
||||
// we tell the caller to fall back.
|
||||
copy_exact(pipe_rd.as_raw_fd(), write_fd.as_raw_fd(), n)?;
|
||||
copy_exact(pipe_rd.as_raw_fd(), write_fd, n)?;
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +55,7 @@ pub(super) fn write_fast_using_splice<R: FdReadable>(
|
|||
/// Move exactly `num_bytes` bytes from `read_fd` to `write_fd`.
|
||||
///
|
||||
/// Panics if not enough bytes can be read.
|
||||
fn copy_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> {
|
||||
fn copy_exact(read_fd: RawFd, write_fd: &impl AsFd, num_bytes: usize) -> nix::Result<()> {
|
||||
let mut left = num_bytes;
|
||||
let mut buf = [0; BUF_SIZE];
|
||||
while left > 0 {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
// spell-checker:ignore parenb parodd cmspar hupcl cstopb cread clocal crtscts CSIZE
|
||||
// spell-checker:ignore ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl ixoff ixon iuclc ixany imaxbel iutf
|
||||
// spell-checker:ignore opost olcuc ocrnl onlcr onocr onlret ofill ofdel nldly crdly tabdly bsdly vtdly ffdly
|
||||
// spell-checker:ignore opost olcuc ocrnl onlcr onocr onlret ofdel nldly crdly tabdly bsdly vtdly ffdly
|
||||
// spell-checker:ignore isig icanon iexten echoe crterase echok echonl noflsh xcase tostop echoprt prterase echoctl ctlecho echoke crtkill flusho extproc
|
||||
// spell-checker:ignore lnext rprnt susp swtch vdiscard veof veol verase vintr vkill vlnext vquit vreprint vstart vstop vsusp vswtc vwerase werase
|
||||
// spell-checker:ignore sigquit sigtstp
|
||||
|
@ -86,14 +86,6 @@ pub const OUTPUT_FLAGS: &[Flag<O>] = &[
|
|||
target_os = "linux",
|
||||
target_os = "macos"
|
||||
))]
|
||||
Flag::new("ofill", O::OFILL),
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
target_os = "haiku",
|
||||
target_os = "ios",
|
||||
target_os = "linux",
|
||||
target_os = "macos"
|
||||
))]
|
||||
Flag::new("ofdel", O::OFDEL),
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
use clap::{crate_version, Arg, ArgAction, Command};
|
||||
use std::io::{IsTerminal, Write};
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use uucore::error::{set_exit_code, UResult};
|
||||
use uucore::{format_usage, help_about, help_usage};
|
||||
|
||||
|
@ -37,8 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
|
||||
let mut stdout = std::io::stdout();
|
||||
|
||||
// Get the ttyname via nix
|
||||
let name = nix::unistd::ttyname(std::io::stdin().as_raw_fd());
|
||||
let name = nix::unistd::ttyname(std::io::stdin());
|
||||
|
||||
let write_result = match name {
|
||||
Ok(name) => writeln!(stdout, "{}", name.display()),
|
||||
|
|
|
@ -8,7 +8,6 @@ use std::fs::File;
|
|||
use std::io::IoSlice;
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::os::unix::io::FromRawFd;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use nix::fcntl::SpliceFFlags;
|
||||
|
@ -21,8 +20,7 @@ pub use nix::{Error, Result};
|
|||
/// from the first.
|
||||
pub fn pipe() -> Result<(File, File)> {
|
||||
let (read, write) = nix::unistd::pipe()?;
|
||||
// SAFETY: The file descriptors do not have other owners.
|
||||
unsafe { Ok((File::from_raw_fd(read), File::from_raw_fd(write))) }
|
||||
Ok((File::from(read), File::from(write)))
|
||||
}
|
||||
|
||||
/// Less noisy wrapper around [`nix::fcntl::splice`].
|
||||
|
|
Loading…
Reference in a new issue