Package: greetd

I hope to update rust-nix to 0.30 soon. Greetd needs a small
patch to build with the new version.

Unfortunately the patch for 0.30 breaks building with 0.29, so
actual uploading to sid will have to wait until rust-nix hits
sid, but in the meantime you can test with the package from
experimental.
diff -Nru greetd-0.10.3/debian/changelog greetd-0.10.3/debian/changelog
--- greetd-0.10.3/debian/changelog      2025-04-08 13:14:57.000000000 +0000
+++ greetd-0.10.3/debian/changelog      2025-09-25 18:40:14.000000000 +0000
@@ -1,3 +1,10 @@
+greetd (0.10.3-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add patch for nix 0.30
+
+ -- Peter Michael Green <[email protected]>  Thu, 25 Sep 2025 18:40:14 +0000
+
 greetd (0.10.3-4) unstable; urgency=medium
 
   [ Marc Dequènes (Duck) ]
diff -Nru greetd-0.10.3/debian/control greetd-0.10.3/debian/control
--- greetd-0.10.3/debian/control        2025-04-08 13:14:57.000000000 +0000
+++ greetd-0.10.3/debian/control        2025-09-25 18:33:26.000000000 +0000
@@ -8,7 +8,7 @@
 # needed for cross-building, dh-cargo only pulls in the :native one
  libstd-rust-dev,
 # greetd & greetd_ipc
- librust-nix-dev (>= 0.29),
+ librust-nix-dev (>= 0.30),
  librust-pam-sys-dev (>= 0.5.6),
  librust-serde-derive-dev (>= 1.0),
  librust-serde-json-dev (>= 1.0),
diff -Nru greetd-0.10.3/debian/patches/nix-0.30.patch 
greetd-0.10.3/debian/patches/nix-0.30.patch
--- greetd-0.10.3/debian/patches/nix-0.30.patch 1970-01-01 00:00:00.000000000 
+0000
+++ greetd-0.10.3/debian/patches/nix-0.30.patch 2025-09-25 18:40:14.000000000 
+0000
@@ -0,0 +1,97 @@
+Description: Tweak code for nix 0.30
+Author: Peter Michael Green <[email protected]>
+
+Index: greetd-0.10.3/greetd/Cargo.toml
+===================================================================
+--- greetd-0.10.3.orig/greetd/Cargo.toml
++++ greetd-0.10.3/greetd/Cargo.toml
+@@ -11,7 +11,7 @@ repository = "https://git.sr.ht/~kennyle
+ debug = []
+ 
+ [dependencies]
+-nix = { version = ">=0.29", features = ["ioctl", "signal", "user", "fs", 
"mman"] }
++nix = { version = ">=0.30", features = ["ioctl", "signal", "user", "fs", 
"mman"] }
+ pam-sys = "0.5.6"
+ serde = { version = "1.0", features = ["derive"] }
+ serde_json = "1.0"
+Index: greetd-0.10.3/greetd/src/terminal/mod.rs
+===================================================================
+--- greetd-0.10.3.orig/greetd/src/terminal/mod.rs
++++ greetd-0.10.3/greetd/src/terminal/mod.rs
+@@ -4,9 +4,11 @@ use crate::error::Error;
+ use nix::{
+     fcntl::{open, OFlag},
+     sys::stat::Mode,
+-    unistd::{close, dup2, write},
++    unistd::{close, dup2_stdin, dup2_stdout, dup2_stderr, write},
+ };
+ use std::{ffi::CStr, os::unix::io::RawFd};
++use std::os::fd::IntoRawFd;
++use std::os::fd::BorrowedFd;
+ 
+ #[allow(dead_code)]
+ pub enum KdMode {
+@@ -66,7 +68,7 @@ impl Terminal {
+         );
+         match res {
+             Ok(fd) => Ok(Terminal {
+-                fd,
++                fd: fd.into_raw_fd(),
+                 autoclose: true,
+             }),
+             Err(e) => return Err(format!("terminal: unable to open: {}", 
e).into()),
+@@ -204,9 +206,10 @@ impl Terminal {
+     /// Hook up stdin, stdout and stderr of the current process ot this
+     /// terminal.
+     pub fn term_connect_pipes(&self) -> Result<(), Error> {
+-        let res = dup2(self.fd, 0)
+-            .and_then(|_| dup2(self.fd, 1))
+-            .and_then(|_| dup2(self.fd, 2));
++        let borrowedfd = unsafe { BorrowedFd::borrow_raw(self.fd) };
++        let res = dup2_stdin(borrowedfd)
++            .and_then(|_| dup2_stdout(borrowedfd))
++            .and_then(|_| dup2_stderr(borrowedfd));
+ 
+         if let Err(v) = res {
+             Err(format!("terminal: unable to connect pipes: {}", v).into())
+Index: greetd-0.10.3/greetd/src/main.rs
+===================================================================
+--- greetd-0.10.3.orig/greetd/src/main.rs
++++ greetd-0.10.3/greetd/src/main.rs
+@@ -11,6 +11,7 @@ use std::os::unix::{
+     io::{FromRawFd, RawFd},
+     net::UnixDatagram,
+ };
++use std::os::fd::BorrowedFd;
+ 
+ use nix::{
+     fcntl::{fcntl, FcntlArg, FdFlag},
+@@ -22,9 +23,10 @@ use crate::{error::Error, session::worke
+ 
+ async fn session_worker_main(config: config::Config) -> Result<(), Error> {
+     let raw_fd = config.internal.session_worker as RawFd;
+-    let mut cur_flags = FdFlag::from_bits_retain(fcntl(raw_fd, 
FcntlArg::F_GETFD)?);
++    let borrowed_fd = unsafe { BorrowedFd::borrow_raw(raw_fd) };
++    let mut cur_flags = FdFlag::from_bits_retain(fcntl(borrowed_fd, 
FcntlArg::F_GETFD)?);
+     cur_flags.insert(FdFlag::FD_CLOEXEC);
+-    fcntl(raw_fd, FcntlArg::F_SETFD(cur_flags))?;
++    fcntl(borrowed_fd, FcntlArg::F_SETFD(cur_flags))?;
+     let sock = unsafe { UnixDatagram::from_raw_fd(raw_fd) };
+     worker::main(&sock)
+ }
+Index: greetd-0.10.3/greetd/src/session/interface.rs
+===================================================================
+--- greetd-0.10.3.orig/greetd/src/session/interface.rs
++++ greetd-0.10.3/greetd/src/session/interface.rs
+@@ -100,9 +100,9 @@ impl Session {
+             UnixDatagram::pair().map_err(|e| format!("could not create pipe: 
{}", e))?;
+ 
+         let raw_child = childfd.as_raw_fd();
+-        let mut cur_flags = FdFlag::from_bits_retain(fcntl(raw_child, 
FcntlArg::F_GETFD)?);
++        let mut cur_flags = FdFlag::from_bits_retain(fcntl(&childfd, 
FcntlArg::F_GETFD)?);
+         cur_flags.remove(FdFlag::FD_CLOEXEC);
+-        fcntl(raw_child, FcntlArg::F_SETFD(cur_flags))?;
++        fcntl(&childfd, FcntlArg::F_SETFD(cur_flags))?;
+ 
+         let cur_exe = std::env::current_exe()?;
+         let bin = CString::new(cur_exe.to_str().expect("unable to get current 
exe name"))?;
diff -Nru greetd-0.10.3/debian/patches/series 
greetd-0.10.3/debian/patches/series
--- greetd-0.10.3/debian/patches/series 2025-04-08 13:14:57.000000000 +0000
+++ greetd-0.10.3/debian/patches/series 2025-09-25 18:38:57.000000000 +0000
@@ -3,3 +3,4 @@
 relax_deps.patch
 rpassword_6.0_adaptation.patch
 nix-0.29.patch
+nix-0.30.patch

Reply via email to