File: nix-0.30.diff

package info (click to toggle)
rust-uucore 0.0.30-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,036 kB
  • sloc: makefile: 2
file content (111 lines) | stat: -rw-r--r-- 3,840 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
This patch is based on the upstream commit described below, adapted for
use in the Debian package by Peter Michael Green.

commit 73e447224ca9de92133ef04914030116e2db024f
Author: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Date:   Thu May 22 16:41:12 2025 +0200

    Adapt to API changes in nix

Index: uucore/src/lib/features/buf_copy.rs
===================================================================
--- uucore.orig/src/lib/features/buf_copy.rs
+++ uucore/src/lib/features/buf_copy.rs
@@ -37,9 +37,6 @@ mod tests {
         },
     };
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    use std::os::fd::AsRawFd;
-
     use std::io::{Read, Write};
 
     #[cfg(unix)]
@@ -61,7 +58,7 @@ mod tests {
         let n = pipe_write.write(data).unwrap();
         assert_eq!(n, data.len());
         let mut buf = [0; 1024];
-        let n = copy_exact(pipe_read.as_raw_fd(), &pipe_write, data.len()).unwrap();
+        let n = copy_exact(&pipe_read, &pipe_write, data.len()).unwrap();
         let n2 = pipe_read.read(&mut buf).unwrap();
         assert_eq!(n, n2);
         assert_eq!(&buf[..n], data);
Index: uucore/src/lib/features/buf_copy/linux.rs
===================================================================
--- uucore.orig/src/lib/features/buf_copy/linux.rs
+++ uucore/src/lib/features/buf_copy/linux.rs
@@ -13,7 +13,7 @@ use crate::{
 /// Buffer-based copying utilities for unix (excluding Linux).
 use std::{
     io::{Read, Write},
-    os::fd::{AsFd, AsRawFd, RawFd},
+    os::fd::{AsFd, AsRawFd},
 };
 
 use super::common::Error;
@@ -105,7 +105,7 @@ where
                     // 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(), dest, n)?;
+                    copy_exact(&pipe_rd, dest, n)?;
                     return Ok((bytes, true));
                 }
 
@@ -122,7 +122,7 @@ where
 /// and `write` calls.
 #[cfg(any(target_os = "linux", target_os = "android"))]
 pub(crate) fn copy_exact(
-    read_fd: RawFd,
+    read_fd: &impl AsFd,
     write_fd: &impl AsFd,
     num_bytes: usize,
 ) -> std::io::Result<usize> {
Index: uucore/src/lib/features/fs.rs
===================================================================
--- uucore.orig/src/lib/features/fs.rs
+++ uucore/src/lib/features/fs.rs
@@ -23,7 +23,9 @@ use std::hash::Hash;
 use std::io::Stdin;
 use std::io::{Error, ErrorKind, Result as IOResult};
 #[cfg(unix)]
-use std::os::unix::{fs::MetadataExt, io::AsRawFd};
+use std::os::fd::AsFd;
+#[cfg(unix)]
+use std::os::unix::fs::MetadataExt;
 use std::path::{Component, Path, PathBuf, MAIN_SEPARATOR};
 #[cfg(target_os = "windows")]
 use winapi_util::AsHandleRef;
@@ -48,8 +50,8 @@ pub struct FileInformation(
 impl FileInformation {
     /// Get information from a currently open file
     #[cfg(unix)]
-    pub fn from_file(file: &impl AsRawFd) -> IOResult<Self> {
-        let stat = nix::sys::stat::fstat(file.as_raw_fd())?;
+    pub fn from_file(file: &impl AsFd) -> IOResult<Self> {
+        let stat = nix::sys::stat::fstat(file)?;
         Ok(Self(stat))
     }
 
@@ -727,7 +729,7 @@ pub fn is_stdin_directory(stdin: &Stdin)
     #[cfg(unix)]
     {
         use nix::sys::stat::fstat;
-        let mode = fstat(stdin.as_raw_fd()).unwrap().st_mode as mode_t;
+        let mode = fstat(stdin.as_fd()).unwrap().st_mode as mode_t;
         has!(mode, S_IFDIR)
     }
 
Index: uucore/Cargo.toml
===================================================================
--- uucore.orig/Cargo.toml
+++ uucore/Cargo.toml
@@ -281,7 +281,7 @@ wide = []
 #default-features = false
 
 [target."cfg(unix)".dependencies.nix]
-version = "0.29"
+version = "0.30"
 features = [
     "fs",
     "uio",