Package: hippotat

I hope to update rust-nix to 0.30 soon, nix 0.30 changes
the read and dup2 apis as part of the crate's gradual move
towards "io safety".

IIRC hippotat values compatibility with a wide range of
nix versions, and furthermore the code didn't seem
paritcularly orientated towards io safety, so I fixed
the build failures by switching to using the libc
versions of read and dup2 directly.
diff -Nru hippotat-1.2.2/Cargo.toml hippotat-1.2.2+nmu1/Cargo.toml
--- hippotat-1.2.2/Cargo.toml   2025-03-20 00:03:35.000000000 +0000
+++ hippotat-1.2.2+nmu1/Cargo.toml      2025-09-27 00:12:04.000000000 +0000
@@ -54,7 +54,7 @@
 log = "0.4.14"
 memchr = "2"
 mime = "0.3.4"
-nix = { version = ">=0.25, <0.30", features = ["fs", "process", "signal", 
"term", "uio"] }
+nix = { version = ">=0.25, <0.31", features = ["fs", "process", "signal", 
"term", "uio"] }
 parking_lot = ">= 0.11, < 0.13"
 pin-project-lite = "0.2"
 reqwest = { version = "0.12.8", features = [ "default-tls" ] }
diff -Nru hippotat-1.2.2/debian/changelog hippotat-1.2.2+nmu1/debian/changelog
--- hippotat-1.2.2/debian/changelog     2025-03-20 00:03:35.000000000 +0000
+++ hippotat-1.2.2+nmu1/debian/changelog        2025-09-27 00:12:04.000000000 
+0000
@@ -1,3 +1,12 @@
+hippotat (1.2.2+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Allow building with version 0.30 of the nix crate.
+  * Switch to the libc versions of dup2 and read to avoid changes in nix
+    0.30.
+
+ -- Peter Michael Green <[email protected]>  Sat, 27 Sep 2025 00:12:04 +0000
+
 hippotat (1.2.2) unstable; urgency=medium
 
   * Replace config custom proc macro with derive-deftly.
diff -Nru hippotat-1.2.2/server/daemon.rs hippotat-1.2.2+nmu1/server/daemon.rs
--- hippotat-1.2.2/server/daemon.rs     2025-03-20 00:03:35.000000000 +0000
+++ hippotat-1.2.2+nmu1/server/daemon.rs        2025-09-27 00:12:04.000000000 
+0000
@@ -7,9 +7,14 @@
 use std::io::IoSlice;
 use std::os::raw::{c_char, c_int};
 use std::os::unix::io::RawFd;
+use std::os::fd::IntoRawFd;
+use std::os::fd::AsRawFd;
 use std::slice;
 use std::str;
 use std::thread::panicking;
+use libc::dup2;
+use libc::read;
+use libc::c_void;
 
 use easy_ext::ext;
 
@@ -87,7 +92,7 @@
 }
 
 unsafe fn mdup2(oldfd: RawFd, newfd: RawFd, what: &str) {
-  match dup2(oldfd, newfd) {
+  match Errno::result(dup2(oldfd, newfd)) {
     Ok(got) if got == newfd => { },
     Ok(_) => crashm("dup2 gave wrong return value"),
     Err(e) => crashv!("dup2 ", what, ": ", e.desc()),
@@ -105,7 +110,7 @@
 unsafe fn parent(st_rfd: RawFd) -> ! {
   let mut exitstatus = 0u8;
   loop {
-    match read(st_rfd, slice::from_mut(&mut exitstatus)) {
+    match Errno::result(read(st_rfd, &raw mut exitstatus as *mut c_void, 1)) {
       Ok(0) => crashm("startup/daemonisation failed"),
       Ok(1) => libc::_exit(exitstatus.into()),
       Ok(_) => crashm("read startup: excess read!"),
@@ -152,7 +157,7 @@
     unsafe {
       let null_fd = open(cstr!(b"/dev/null\0"), OFlag::O_RDWR, Mode::empty())
         .context("open /dev/null");
-      mdup2(null_fd, 0, "null onto stdin");
+      mdup2(null_fd.as_raw_fd(), 0, "null onto stdin");
 
       let (st_rfd, st_wfd) = compat::pipe().context("pipe");
 
@@ -178,7 +183,7 @@
       Daemoniser {
         drop_bomb: Some(()),
         intermediate_pid,
-        null_fd,
+        null_fd: null_fd.into_raw_fd(),
         st_wfd,
       }
     }

Reply via email to