Compare commits

...

4 Commits

Author SHA1 Message Date
Fabio Valentini c137f94977
Fix port of test code to nix 0.29 to avoid flaky failures
4 months ago
Michel Lind 4c68de9c09 Bump nix from 0.24.1 to 0.29
4 months ago
Fedora Release Engineering 23e3b65ecf Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
7 months ago
Fedora Release Engineering 4b58c67e0b Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
1 year ago

@ -1,5 +1,5 @@
--- clircle-0.4.0/Cargo.toml 1970-01-01T00:00:01+00:00 --- clircle-0.4.0/Cargo.toml 1970-01-01T00:00:01+00:00
+++ clircle-0.4.0/Cargo.toml 2023-10-29T04:03:10.303427+00:00 +++ clircle-0.4.0/Cargo.toml 2024-10-23T20:12:14.073424+00:00
@@ -55,14 +55,3 @@ @@ -55,14 +55,3 @@
features = ["term"] features = ["term"]
default-features = false default-features = false

@ -0,0 +1,11 @@
--- clircle-0.4.0/Cargo.toml 1970-01-01T00:00:01+00:00
+++ clircle-0.4.0/Cargo.toml 2024-10-23T20:12:19.939974+00:00
@@ -51,7 +51,7 @@
version = "0.2"
[target."cfg(not(windows))".dev-dependencies.nix]
-version = "0.24.1"
+version = "0.29"
features = ["term"]
default-features = false

@ -0,0 +1,66 @@
diff --git a/src/clircle_unix.rs b/src/clircle_unix.rs
index 101f208..56448b9 100644
--- a/src/clircle_unix.rs
+++ b/src/clircle_unix.rs
@@ -4,7 +4,7 @@ use std::convert::TryFrom;
use std::fs::File;
use std::io::{self, Seek};
use std::os::unix::fs::MetadataExt;
-use std::os::unix::io::{FromRawFd, IntoRawFd, RawFd};
+use std::os::unix::io::{FromRawFd, IntoRawFd, OwnedFd, RawFd};
use std::{cmp, hash, ops};
/// Re-export of libc
@@ -53,6 +53,13 @@ impl UnixIdentifier {
ident
})
}
+
+ fn try_from_owned_fd(fd: OwnedFd) -> io::Result<Self> {
+ Self::try_from(File::from(fd)).map(|mut ident| {
+ ident.owns_fd = true;
+ ident
+ })
+ }
}
impl Clircle for UnixIdentifier {
@@ -135,6 +142,7 @@ mod tests {
use std::error::Error;
use std::io::Write;
+ use std::os::unix::io::AsRawFd;
use nix::pty::{openpty, OpenptyResult};
use nix::unistd::close;
@@ -186,7 +194,7 @@ mod tests {
#[test]
fn test_pty_equal_but_not_conflicting() -> Result<(), &'static str> {
let OpenptyResult { master, slave } = openpty(None, None).expect("Could not open pty.");
- let res = unsafe { UnixIdentifier::try_from_raw_fd(slave, false) }
+ let res = unsafe { UnixIdentifier::try_from_raw_fd(slave.as_raw_fd(), false) }
.map_err(|_| "Error creating UnixIdentifier from pty fd")
.and_then(|ident| {
if !ident.eq(&ident) {
@@ -196,7 +204,7 @@ mod tests {
return Err("pty fd does not conflict with itself, but conflict detected");
}
- let second_ident = unsafe { UnixIdentifier::try_from_raw_fd(slave, false) }
+ let second_ident = UnixIdentifier::try_from_owned_fd(slave)
.map_err(|_| "Error creating second Identifier to pty")?;
if !ident.eq(&second_ident) {
return Err("ident != second_ident");
@@ -209,12 +217,6 @@ mod tests {
Ok(())
});
- let r1 = close(master);
- let r2 = close(slave);
-
- r1.expect("Error closing master end of pty");
- r2.expect("Error closing slave end of pty");
-
res
}
}

@ -1,4 +1,4 @@
# Generated by rust2rpm 24 # Generated by rust2rpm 26
%bcond_without check %bcond_without check
%global debug_package %{nil} %global debug_package %{nil}
@ -12,10 +12,15 @@ Summary: Detect IO circles in your CLI apps arguments
License: MIT OR Apache-2.0 License: MIT OR Apache-2.0
URL: https://crates.io/crates/clircle URL: https://crates.io/crates/clircle
Source: %{crates_source} Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies # Automatically generated patch to strip dependencies and normalize metadata
Patch: clircle-fix-metadata-auto.diff Patch: clircle-fix-metadata-auto.diff
# Manually created patch for downstream crate metadata changes
# * bump nix from 0.24.1 to 0.29
Patch: clircle-fix-metadata.diff
# Handle nix now returning OwnedFd since 0.27
Patch: clircle-handle_ownedfd_for_nix_ge_0_27.diff
BuildRequires: rust-packaging >= 21 BuildRequires: cargo-rpm-macros >= 24
%global _description %{expand: %global _description %{expand:
Detect IO circles in your CLI apps arguments.} Detect IO circles in your CLI apps arguments.}
@ -62,7 +67,7 @@ use the "serde" feature of the "%{crate}" crate.
%ghost %{crate_instdir}/Cargo.toml %ghost %{crate_instdir}/Cargo.toml
%prep %prep
%autosetup -n %{crate}-%{version_no_tilde} -p1 %autosetup -n %{crate}-%{version} -p1
%cargo_prep %cargo_prep
%generate_buildrequires %generate_buildrequires

Loading…
Cancel
Save