Files
MSYS2-packages/fish/0002-patch-dep.patch
T
2025-08-18 15:52:06 +03:00

133 lines
5.4 KiB
Diff

diff --git a/Cargo.toml b/Cargo.toml
index 37cdc1332..3aa89374e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -40,7 +40,7 @@ libc = "0.2.155"
# disabling default features uses the stdlib instead, but it doubles the time to rewrite the history
# files as of 22 April 2024.
lru = "0.12.3"
-nix = { version = "0.29.0", default-features = false, features = [
+nix = { version = "0.30.1", default-features = false, features = [
"event",
"inotify",
"resource",
diff --git a/src/common.rs b/src/common.rs
index f4af57cd9..48252b7e6 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1337,7 +1337,7 @@ fn can_be_encoded(wc: char) -> bool {
/// Return the number of bytes read, or 0 on EOF, or an error.
pub fn read_blocked(fd: RawFd, buf: &mut [u8]) -> nix::Result<usize> {
loop {
- let res = nix::unistd::read(fd, buf);
+ let res = nix::unistd::read(unsafe { BorrowedFd::borrow_raw(fd) }, buf);
if let Err(nix::Error::EINTR) = res {
continue;
}
@@ -1379,8 +1379,7 @@ pub fn write_loop<Fd: AsRawFd>(fd: &Fd, buf: &[u8]) -> std::io::Result<()> {
/// favor of native rust read/write methods at some point.
///
/// Returns the number of bytes read or an IO error.
-pub fn read_loop<Fd: AsRawFd>(fd: &Fd, buf: &mut [u8]) -> std::io::Result<usize> {
- let fd = fd.as_raw_fd();
+pub fn read_loop<Fd: AsFd>(fd: &Fd, buf: &mut [u8]) -> std::io::Result<usize> {
loop {
match nix::unistd::read(fd, buf) {
Ok(read) => {
diff --git a/src/env_universal_common.rs b/src/env_universal_common.rs
index e6e76a067..42ba921f1 100644
--- a/src/env_universal_common.rs
+++ b/src/env_universal_common.rs
@@ -24,7 +24,7 @@
use std::ffi::CString;
use std::fs::File;
use std::mem::MaybeUninit;
-use std::os::fd::{AsFd, AsRawFd, RawFd};
+use std::os::fd::{AsFd, AsRawFd};
use std::os::unix::prelude::MetadataExt;
// Pull in the O_EXLOCK constant if it is defined, otherwise set it to 0.
@@ -398,7 +398,7 @@ fn load_from_fd(&mut self, file: &mut File, callbacks: &mut CallbackDataList) {
} else {
// Read a variables table from the file.
let mut new_vars = VarTable::new();
- let format = Self::read_message_internal(file.as_raw_fd(), &mut new_vars);
+ let format = Self::read_message_internal(file, &mut new_vars);
// Hacky: if the read format is in the future, avoid overwriting the file: never try to
// save.
@@ -726,7 +726,7 @@ fn parse_message_2x_internal(msg: &wstr, vars: &mut VarTable, storage: &mut WStr
}
}
- fn read_message_internal(fd: RawFd, vars: &mut VarTable) -> UvarFormat {
+ fn read_message_internal(fd: impl AsFd, vars: &mut VarTable) -> UvarFormat {
// Read everything from the fd. Put a sane limit on it.
let mut contents = vec![];
let mut buffer = [0_u8; 4096];
diff --git a/src/fds.rs b/src/fds.rs
index fbc7507db..42ec61d1c 100644
--- a/src/fds.rs
+++ b/src/fds.rs
@@ -30,7 +30,7 @@ pub struct AutoCloseFd {
impl Read for AutoCloseFd {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
- nix::unistd::read(self.as_raw_fd(), buf).map_err(std::io::Error::from)
+ nix::unistd::read(self, buf).map_err(std::io::Error::from)
}
}
@@ -187,7 +187,7 @@ fn heightenize_fd(fd: OwnedFd, input_has_cloexec: bool) -> nix::Result<OwnedFd>
}
// Here we are asking the kernel to give us a cloexec fd.
- let newfd = match nix::fcntl::fcntl(raw_fd, FcntlArg::F_DUPFD_CLOEXEC(FIRST_HIGH_FD)) {
+ let newfd = match nix::fcntl::fcntl(&fd, FcntlArg::F_DUPFD_CLOEXEC(FIRST_HIGH_FD)) {
Ok(newfd) => newfd,
Err(err) => {
perror("fcntl");
@@ -238,7 +238,7 @@ pub fn open_cloexec(path: &CStr, flags: OFlag, mode: nix::sys::stat::Mode) -> ni
// If it is that's our cancel signal, so we abort.
loop {
let ret = nix::fcntl::open(path, flags | OFlag::O_CLOEXEC, mode);
- let ret = ret.map(|raw_fd| unsafe { File::from_raw_fd(raw_fd) });
+ let ret = ret.map(|raw_fd| File::from(raw_fd));
match ret {
Ok(file) => {
return Ok(file);
diff --git a/src/reader.rs b/src/reader.rs
index 45cb70554..f5d28ef0c 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -30,6 +30,7 @@
use std::num::NonZeroUsize;
use std::ops::ControlFlow;
use std::ops::Range;
+use std::os::fd::BorrowedFd;
use std::os::fd::RawFd;
use std::pin::Pin;
use std::rc::Rc;
@@ -783,7 +784,7 @@ fn read_ni(parser: &Parser, fd: RawFd, io: &IoChain) -> i32 {
loop {
let mut buff = [0_u8; 4096];
- match nix::unistd::read(fd, &mut buff) {
+ match nix::unistd::read(unsafe { BorrowedFd::borrow_raw(fd) }, &mut buff) {
Ok(0) => {
// EOF.
break;
diff --git a/src/topic_monitor.rs b/src/topic_monitor.rs
index 4698001f3..3f83ad9c3 100644
--- a/src/topic_monitor.rs
+++ b/src/topic_monitor.rs
@@ -243,7 +243,7 @@ pub fn wait(&self) {
let _ = FdReadableSet::is_fd_readable(fd, Timeout::Forever);
}
let mut ignored: u8 = 0;
- match unistd::read(fd, std::slice::from_mut(&mut ignored)) {
+ match unistd::read(&pipes.read, std::slice::from_mut(&mut ignored)) {
Ok(1) => break,
Ok(_) => continue,
// EAGAIN should only be possible if TSAN workarounds have been applied