Source: mupdf
Severity: normal
Tags: patch ftbfs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear maintainer,

2 days ago sioyek was accepted into the Debian archive, but it fails to
build on GNU Hurd because of an old version of mupdf.

While GNU Hurd is not a release architecture, I managed to find out why
mupdf fails to build.

I have attached a patch that fixes the build issue on GNU Hurd without
breaking any other architectures.

Kind regards,


Victor Westerhuis


- -- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (100, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0-6-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_NL.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en_US:en:nl_NL:nl
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCAAxFiEE6OxII3T+o0Ujs6ECQz2Rq5dHQPsFAmPDRksTHHZpY3RvckB3
ZXN0ZXJodS5pcwAKCRBDPZGrl0dA+9bMEACc75Oe2An9GtjTKPk8m1V1zGxff98x
v8F37eksHw2Ym6tcGZvj7ScDpzJ6eOnR4T/1HJHDrGYUwwkoCyDHAVu0sV+PH1Wz
NKAz0ozGm7rJglcoVFkvebinsCbqTOdcXIN8N9R2SnyrNW9LakgODKDlWzdexmgK
YYRueG9V4konee8xv4Sh4IuR5wqnEt1GYRfyDnBzZom01SwEB9puDWAUizmNm3vV
PXcniwbq3SdjUMguHiqf/DTC2o/4r2OP3npphuz/m4ASp8LXm9hQX7J3JTeiBlJF
xbHb75r3GlbDTUq03TeDkmQRKk2dUjzbMulsGGAbgMshbYDf+9jTXSOwRgDIkjxT
B5sq/i2ZLeYIvyyB6WS2wMiHgG5pwcHovBl474FcCI/4Hk/A4042AAWkTFtRIk2L
x9kbDDnSKx/OZZXBO6XP6RXTDuUqpeVEweg6rJv+JYzDhcOplwNrkj7uVT4bjkq8
tR6p+ynBtLIh9LRH5+uD2win/+pjionAWXmzjy95hDwEkDOhaG1gwOLFvGqxF+oC
sZtM53dXqQrgfz87VEHRnjy3eCakmnjmIokQ35h5mpBVp88FLl/l/h+dBszHvAv0
FTariZHkwCOzJQOdIOEjO8vDlohsCPFYt+FXtt0edGI3k69kixf1zmSQ49gsrETw
hjb8LD5g4BonOg==
=PFi4
-----END PGP SIGNATURE-----
From: Victor Westerhuis <vic...@westerhu.is>
Date: Sun, 15 Jan 2023 00:21:34 +0100
Subject: Add fallback for missing SA_NOCLDWAIT

GNU Hurd does not implement SA_NOCLDWAIT. It also does not
automatically reap zombies if SIGCHLD is ignored.

This fallback does not check for failures from waitpid(2), because
there is not much the program can do about them.
---
 platform/gl/gl-main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index d5ae69c..3060020 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -2957,6 +2957,11 @@ static void signal_handler(int signal)
 {
        if (signal == SIGHUP)
                reloadrequested = 1;
+#ifndef SA_NOCLDWAIT
+       else if (signal == SIGCHLD)
+               while (waitpid(-1, NULL, WNOHANG) > 0)
+                       ;
+#endif
 }
 #endif
 
@@ -2973,11 +2978,18 @@ int main(int argc, char **argv)
 #ifndef _WIN32
 
        /* Never wait for termination of child processes. */
+#ifdef SA_NOCLDWAIT
        struct sigaction arg = {
                .sa_handler=SIG_IGN,
                .sa_flags=SA_NOCLDWAIT
        };
        sigaction(SIGCHLD, &arg, NULL);
+#else
+       struct sigaction arg = {
+               .sa_handler=signal_handler
+       };
+       sigaction(SIGCHLD, &arg, NULL);
+#endif
 
        signal(SIGHUP, signal_handler);
 #endif

Reply via email to