Package: meli I hope to update rust-nix to version 0.30 soon. I put together a patch to make meli build with the new version.
However, while doing so I ran into an issue that I belive indicates broken code. Nix 0.30 removed the "copy" trait from the "PollFd" type because "|PollFd| implementing |Copy| makes it easy to accidentally refer to the wrong object after putting one into an array.". I added .clone calls to get the code building, but I belive that the code is suffering from the issue that caused the nix developers to remove the "copy" impl. The conditional logic is looking at the original pollfd's, not the pollfds that have been mutated by poll. This is IMO something you may want to discuss with upstream.
diff -Nru meli-0.8.12+dfsg/debian/changelog meli-0.8.12+dfsg/debian/changelog --- meli-0.8.12+dfsg/debian/changelog 2025-09-24 20:15:36.000000000 +0000 +++ meli-0.8.12+dfsg/debian/changelog 2025-09-28 07:44:36.000000000 +0000 @@ -1,3 +1,10 @@ +meli (0.8.12+dfsg-3.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Add patch for nix 0.30 + + -- PeterMichael Green <[email protected]> Sun, 28 Sep 2025 07:44:36 +0000 + meli (0.8.12+dfsg-3) unstable; urgency=medium * add patch 1001_assert_cmd diff -Nru meli-0.8.12+dfsg/debian/control meli-0.8.12+dfsg/debian/control --- meli-0.8.12+dfsg/debian/control 2025-09-24 19:59:07.000000000 +0000 +++ meli-0.8.12+dfsg/debian/control 2025-09-28 07:44:36.000000000 +0000 @@ -32,15 +32,15 @@ librust-libc-0.2+extra-traits-dev, librust-linkify-dev (<< 0.11), librust-native-tls-0.2+default-dev, - librust-nix-0.29+dir-dev, - librust-nix-0.29+fs-dev, - librust-nix-0.29+hostname-dev, - librust-nix-0.29+ioctl-dev, - librust-nix-0.29+poll-dev, - librust-nix-0.29+process-dev, - librust-nix-0.29+signal-dev, - librust-nix-0.29+socket-dev, - librust-nix-0.29+term-dev, + librust-nix-0.30+dir-dev, + librust-nix-0.30+fs-dev, + librust-nix-0.30+hostname-dev, + librust-nix-0.30+ioctl-dev, + librust-nix-0.30+poll-dev, + librust-nix-0.30+process-dev, + librust-nix-0.30+signal-dev, + librust-nix-0.30+socket-dev, + librust-nix-0.30+term-dev, librust-nom-7+default-dev, librust-notify-rust-4+default-dev, librust-notify-8+default-dev, diff -Nru meli-0.8.12+dfsg/debian/patches/2005_nix.patch meli-0.8.12+dfsg/debian/patches/2005_nix.patch --- meli-0.8.12+dfsg/debian/patches/2005_nix.patch 1970-01-01 00:00:00.000000000 +0000 +++ meli-0.8.12+dfsg/debian/patches/2005_nix.patch 2025-09-28 07:44:36.000000000 +0000 @@ -0,0 +1,154 @@ +Index: meli-0.8.12+dfsg/meli/Cargo.toml +=================================================================== +--- meli-0.8.12+dfsg.orig/meli/Cargo.toml ++++ meli-0.8.12+dfsg/meli/Cargo.toml +@@ -34,7 +34,7 @@ itoa = { version = "1.0.11", default-fea + libc = { version = "0.2.125", default-features = false, features = ["extra_traits"] } + linkify = { version = ">= 0.9.0, <= 0.10", default-features = false } + melib = { path = "../melib", version = "0.8.12", features = [] } +-nix = { version = "0.29", default-features = false, features = ["signal", "poll", "term", "ioctl", "process"] } ++nix = { version = "0.30", default-features = false, features = ["signal", "poll", "term", "ioctl", "process"] } + regex = { version = "1" } + serde = { version = "1.0.71" } + serde_derive = { version = "1.0.71" } +Index: meli-0.8.12+dfsg/tools/Cargo.toml +=================================================================== +--- meli-0.8.12+dfsg.orig/tools/Cargo.toml ++++ meli-0.8.12+dfsg/tools/Cargo.toml +@@ -30,7 +30,7 @@ required-features = ["melib/imap"] + crossbeam = { version = "^0.8" } + meli = { path = "../meli", version = "0.8" } + melib = { path = "../melib", version = "0.8", features = ["debug-tracing" ] } +-nix = { version = "0.29", default-features = false, features = ["signal", "poll", "term", "ioctl", "process"] } ++nix = { version = "0.30", default-features = false, features = ["signal", "poll", "term", "ioctl", "process"] } + signal-hook = { version = "^0.3", default-features = false, features = ["iterator"] } + signal-hook-registry = { version = "1.2.0", default-features = false } + +Index: meli-0.8.12+dfsg/melib/Cargo.toml +=================================================================== +--- meli-0.8.12+dfsg.orig/melib/Cargo.toml ++++ meli-0.8.12+dfsg/melib/Cargo.toml +@@ -35,7 +35,7 @@ libc = { version = "0.2.125", features = + libloading = { version = "^0.8" } + log = { version = "0.4", features = ["std"] } + native-tls = { version = "0.2.3", default-features = false, optional = true } +-nix = { version = "0.29", default-features = false, features = ["fs", "socket", "dir", "hostname"] } ++nix = { version = "0.30", default-features = false, features = ["fs", "socket", "dir", "hostname"] } + nom = { version = "7" } + notify = { version = ">= 6.1.1, <= 8", optional = true } + polling = { version = "3" } +Index: meli-0.8.12+dfsg/melib/src/utils/connections.rs +=================================================================== +--- meli-0.8.12+dfsg.orig/melib/src/utils/connections.rs ++++ meli-0.8.12+dfsg/melib/src/utils/connections.rs +@@ -294,7 +294,7 @@ impl Connection { + Fd { inner, .. } => { + // [ref:VERIFY] + nix::fcntl::fcntl( +- inner.as_raw_fd(), ++ inner, + nix::fcntl::FcntlArg::F_SETFL(if nonblocking { + nix::fcntl::OFlag::O_NONBLOCK + } else { +Index: meli-0.8.12+dfsg/melib/src/utils/shellexpand.rs +=================================================================== +--- meli-0.8.12+dfsg.orig/melib/src/utils/shellexpand.rs ++++ meli-0.8.12+dfsg/melib/src/utils/shellexpand.rs +@@ -236,15 +236,13 @@ pub mod impls { + (prefix, last_component) + }; + +- let dir = match ::nix::dir::Dir::openat( +- Some(::libc::AT_FDCWD), ++ let dir = match ::nix::dir::Dir::open( + prefix, + OFlag::O_DIRECTORY | OFlag::O_NOATIME | OFlag::O_RDONLY | OFlag::O_CLOEXEC, + ::nix::sys::stat::Mode::S_IRUSR | ::nix::sys::stat::Mode::S_IXUSR, + ) + .or_else(|_| { +- ::nix::dir::Dir::openat( +- Some(::libc::AT_FDCWD), ++ ::nix::dir::Dir::open( + prefix, + OFlag::O_DIRECTORY | OFlag::O_RDONLY | OFlag::O_CLOEXEC, + ::nix::sys::stat::Mode::S_IRUSR | ::nix::sys::stat::Mode::S_IXUSR, +Index: meli-0.8.12+dfsg/meli/src/state.rs +=================================================================== +--- meli-0.8.12+dfsg.orig/meli/src/state.rs ++++ meli-0.8.12+dfsg/meli/src/state.rs +@@ -79,13 +79,12 @@ impl InputHandler { + * thread will receive it and die. */ + //let _ = self.rx.try_iter().count(); + let rx = self.rx.clone(); +- let pipe = nix::unistd::dup(self.pipe.0.as_raw_fd()) ++ let pipe = nix::unistd::dup(&self.pipe.0) + .expect("Fatal: Could not dup() input pipe file descriptor"); + let tx = self.state_tx.clone(); + thread::Builder::new() + .name("input-thread".to_string()) + .spawn(move || { +- let pipe = unsafe { OwnedFd::from_raw_fd(pipe) }; + get_events( + |i| { + tx.send(ThreadEvent::Input(i)).unwrap(); +Index: meli-0.8.12+dfsg/meli/src/terminal/embedded.rs +=================================================================== +--- meli-0.8.12+dfsg.orig/meli/src/terminal/embedded.rs ++++ meli-0.8.12+dfsg/meli/src/terminal/embedded.rs +@@ -41,7 +41,7 @@ use nix::{ + ioctl_none_bad, ioctl_write_ptr_bad, + libc::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO}, + pty::Winsize, +- unistd::{dup2, fork, ForkResult}, ++ unistd::{dup2, dup2_stdin, dup2_stdout, dup2_stderr, fork, ForkResult}, + }; + use smallvec::SmallVec; + +@@ -166,9 +166,9 @@ pub fn create_pty(width: usize, height: + let backend_fd = open(Path::new(&backend_name), OFlag::O_RDWR, stat::Mode::empty())?; + + // assign stdin, stdout, stderr to the pty +- dup2(backend_fd.as_raw_fd(), STDIN_FILENO).expect("could not dup2 STDIN"); +- dup2(backend_fd.as_raw_fd(), STDOUT_FILENO).expect("could not dup2 STDOUT"); +- dup2(backend_fd.as_raw_fd(), STDERR_FILENO).expect("could not dup2 STDERR"); ++ dup2_stdin(&backend_fd).expect("could not dup2 STDIN"); ++ dup2_stdout(&backend_fd).expect("could not dup2 STDOUT"); ++ dup2_stderr(&backend_fd).expect("could not dup2 STDERR"); + // Become session leader + nix::unistd::setsid().expect("Forked terminal process could not become session leader"); + match unsafe { set_controlling_terminal(backend_fd.as_raw_fd()) } { +Index: meli-0.8.12+dfsg/meli/src/terminal/keys.rs +=================================================================== +--- meli-0.8.12+dfsg.orig/meli/src/terminal/keys.rs ++++ meli-0.8.12+dfsg/meli/src/terminal/keys.rs +@@ -295,7 +295,7 @@ pub fn get_events( + let mut palette = (None, None); + let mut paste_buf = String::with_capacity(256); + let mut stdin_iter = stdin.events_and_raw(); +- 'poll_while: while let Ok(_n_raw) = poll(&mut [new_command_pollfd, stdin_fd], PollTimeout::NONE) ++ 'poll_while: while let Ok(_n_raw) = poll(&mut [new_command_pollfd.clone(), stdin_fd.clone()], PollTimeout::NONE) + { + select! { + default => { +@@ -456,7 +456,7 @@ pub fn get_events( + if pselect_result.is_err() || error_fd_set.highest().map(|bfd| bfd.as_raw_fd()) == Some(new_command_fd.as_raw_fd()) || read_fd_set.highest().map(|bfd| bfd.as_raw_fd()) != Some(new_command_fd.as_raw_fd()) { + continue 'poll_while; + }; +- let _ = nix::unistd::read(new_command_fd.as_raw_fd(), buf.as_mut()); ++ let _ = nix::unistd::read(new_command_fd, buf.as_mut()); + match cmd.unwrap_or_default() { + InputCommand::Kill => return, + } +Index: meli-0.8.12+dfsg/meli/src/signal_handlers.rs +=================================================================== +--- meli-0.8.12+dfsg.orig/meli/src/signal_handlers.rs ++++ meli-0.8.12+dfsg/meli/src/signal_handlers.rs +@@ -47,7 +47,7 @@ pub fn notify( + let (s, r) = crossbeam::channel::bounded(100); + let mut signals = signal_hook::iterator::Signals::new(signals)?; + let _ = nix::fcntl::fcntl( +- alarm_pipe_r.as_raw_fd(), ++ alarm_pipe_r, + nix::fcntl::FcntlArg::F_SETFL(nix::fcntl::OFlag::O_NONBLOCK), + ); + std::thread::spawn(move || { diff -Nru meli-0.8.12+dfsg/debian/patches/series meli-0.8.12+dfsg/debian/patches/series --- meli-0.8.12+dfsg/debian/patches/series 2025-09-24 20:13:53.000000000 +0000 +++ meli-0.8.12+dfsg/debian/patches/series 2025-09-28 07:44:36.000000000 +0000 @@ -7,3 +7,4 @@ 2003_unicode.patch 2004_no_hardcode_defaults.patch 2004_no_jmap_server_test.patch +2005_nix.patch

