Control: tags 1138217 + patch

The attached debdiff fixes the build and installation of the package on
GNU/Hurd.

The main problem is that there is both a debian/postinst and a
debian/procps.postinst in the debian folder. This means that
debian/postinst is ignored in favour of debian/procps.postinst. The
alternatives were handled in the ignored file.

The debdiff also addresses some other issues with the GNU/urd build of
the package.

        Mattias
diff -Nru procps-4.0.6/debian/changelog procps-4.0.6/debian/changelog
--- procps-4.0.6/debian/changelog	2026-01-29 11:34:30.000000000 +0100
+++ procps-4.0.6/debian/changelog	2026-05-30 13:51:35.000000000 +0200
@@ -1,3 +1,10 @@
+procps (2:4.0.6-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix compilation and installation on GNU/Hurd (Closes: #1138217)
+
+ -- Mattias Ellert <[email protected]>  Sat, 30 May 2026 13:51:35 +0200
+
 procps (2:4.0.6-1) experimental; urgency=medium
 
   * New upstream version
diff -Nru procps-4.0.6/debian/patches/fix-pointer-check procps-4.0.6/debian/patches/fix-pointer-check
--- procps-4.0.6/debian/patches/fix-pointer-check	1970-01-01 01:00:00.000000000 +0100
+++ procps-4.0.6/debian/patches/fix-pointer-check	2026-05-30 13:51:35.000000000 +0200
@@ -0,0 +1,20 @@
+Description:
+ Any pointer other than NULL is valid. The hack to reject pointers
+ less than 0x8000 in an attempt to catch coding errors (an enum
+ instead of a pointer to an enum) results in runtime errors. This
+ leads to test suite failures and package FTBFS bugs. Use normal NULL
+ test for pointer validity check.
+Author: Mattias Ellert <[email protected]>
+
+--- procps-4.0.6.orig/library/pids.c	2026-01-29 10:48:26.000000000 +0100
++++ procps-4.0.6/library/pids.c	2026-05-30 11:14:52.000000000 +0200
+@@ -1039,8 +1042,7 @@
+      * if (procps_pids_new(&info, PIDS_noop, 3) < 0)
+      *                            ^~~~~~~~~~~~~~~~
+      */
+-    if (numitems < 1
+-    || (void *)items < (void *)0x8000)      // twice as big as our largest enum
++    if (numitems < 1 || items == NULL)
+         return 1;
+ 
+     for (i = 0; i < numitems; i++) {
diff -Nru procps-4.0.6/debian/patches/no-boottime procps-4.0.6/debian/patches/no-boottime
--- procps-4.0.6/debian/patches/no-boottime	1970-01-01 01:00:00.000000000 +0100
+++ procps-4.0.6/debian/patches/no-boottime	2026-05-30 13:51:35.000000000 +0200
@@ -0,0 +1,45 @@
+Description:
+ CLOCK_BOOTTIME is a Linux extension. Use CLOCK_MONOTONIC when not available.
+Author: Mattias Ellert <[email protected]>
+
+diff -ur procps-4.0.6.orig/library/pids.c procps-4.0.6/library/pids.c
+--- procps-4.0.6.orig/library/pids.c	2026-01-29 10:48:26.000000000 +0100
++++ procps-4.0.6/library/pids.c	2026-05-30 05:33:38.000000000 +0200
+@@ -42,6 +42,9 @@
+ #include "procps-private.h"
+ #include "pids.h"
+ 
++#ifndef CLOCK_BOOTTIME
++#define CLOCK_BOOTTIME CLOCK_MONOTONIC
++#endif
+ 
+ //#define UNREF_RPTHASH                // report hash details at uref() time
+ 
+diff -ur procps-4.0.6.orig/library/uptime.c procps-4.0.6/library/uptime.c
+--- procps-4.0.6.orig/library/uptime.c	2026-01-29 10:48:26.000000000 +0100
++++ procps-4.0.6/library/uptime.c	2026-05-30 05:32:32.000000000 +0200
+@@ -44,6 +44,10 @@
+ #include "procps-private.h"
+ #include "pids.h"
+ 
++#ifndef CLOCK_BOOTTIME
++#define CLOCK_BOOTTIME CLOCK_MONOTONIC
++#endif
++
+ #define UPTIME_FILE "/proc/uptime"
+ 
+ #define UPTIME_BUFLEN 256
+diff -ur procps-4.0.6.orig/src/top/top.c procps-4.0.6/src/top/top.c
+--- procps-4.0.6.orig/src/top/top.c	2026-01-29 10:48:26.000000000 +0100
++++ procps-4.0.6/src/top/top.c	2026-05-30 05:31:50.000000000 +0200
+@@ -59,6 +59,10 @@
+ #include "top.h"
+ #include "top_nls.h"
+ 
++#ifndef CLOCK_BOOTTIME
++#define CLOCK_BOOTTIME CLOCK_MONOTONIC
++#endif
++
+ /*######  Miscellaneous global stuff  ####################################*/
+ 
+         /* The original and new terminal definitions
diff -Nru procps-4.0.6/debian/patches/no-hugetlb procps-4.0.6/debian/patches/no-hugetlb
--- procps-4.0.6/debian/patches/no-hugetlb	1970-01-01 01:00:00.000000000 +0100
+++ procps-4.0.6/debian/patches/no-hugetlb	2026-05-30 13:51:35.000000000 +0200
@@ -0,0 +1,18 @@
+Description:
+ MAP_HUGETLB is Linux specific. Ignore when not available.
+Author: Mattias Ellert <[email protected]>
+
+diff -ur procps-4.0.6.orig/testsuite/ps.test/test-hugetlb.c procps-4.0.6/testsuite/ps.test/test-hugetlb.c
+--- procps-4.0.6.orig/testsuite/ps.test/test-hugetlb.c	2026-01-29 10:48:26.000000000 +0100
++++ procps-4.0.6/testsuite/ps.test/test-hugetlb.c	2026-05-30 05:15:34.000000000 +0200
+@@ -35,6 +35,10 @@
+ #include <string.h>
+ #include <sys/mman.h>
+ 
++#ifndef MAP_HUGETLB
++#define MAP_HUGETLB 0
++#endif
++
+ #define LENGTH (2*1024*1024)
+ 
+ void usage(const char *progname, const char *msg)
diff -Nru procps-4.0.6/debian/patches/no-opath procps-4.0.6/debian/patches/no-opath
--- procps-4.0.6/debian/patches/no-opath	1970-01-01 01:00:00.000000000 +0100
+++ procps-4.0.6/debian/patches/no-opath	2026-05-30 13:51:35.000000000 +0200
@@ -0,0 +1,17 @@
+Description:
+ O_PATH is a Linux extension. The corresponding extension on GNU/Hurd is O_NORW.
+Author: Mattias Ellert <[email protected]>
+
+--- procps-4.0.6.orig/library/readproc.c	2026-01-29 10:48:26.000000000 +0100
++++ procps-4.0.6/library/readproc.c	2026-05-30 06:56:10.000000000 +0200
+@@ -61,6 +61,10 @@
+ #define LEAVE(x)
+ #endif
+ 
++#ifndef O_PATH
++#define O_PATH O_NORW
++#endif
++
+ #ifdef FALSE_THREADS
+ #define IS_THREAD(q) ( q->tid != q->tgid )
+ #endif
diff -Nru procps-4.0.6/debian/patches/series procps-4.0.6/debian/patches/series
--- procps-4.0.6/debian/patches/series	2026-01-29 11:34:30.000000000 +0100
+++ procps-4.0.6/debian/patches/series	2026-05-30 11:23:23.000000000 +0200
@@ -3,3 +3,7 @@
 uptime_test
 pmap_test
 makefile_add_pkill
+no-hugetlb
+no-boottime
+no-opath
+fix-pointer-check
diff -Nru procps-4.0.6/debian/postinst procps-4.0.6/debian/postinst
--- procps-4.0.6/debian/postinst	2026-01-29 11:34:30.000000000 +0100
+++ procps-4.0.6/debian/postinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,105 +0,0 @@
-#!/bin/sh
-# postinst script for procps
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-#
-# quoting from the policy:
-#     Any necessary prompting should almost always be confined to the
-#     post-installation script, and should be protected with a conditional
-#     so that unnecessary prompting doesn't happen if a package's
-#     installation fails and the `postinst' is called with `abort-upgrade',
-#     `abort-remove' or `abort-deconfigure'.
-
-# Move a conffile without triggering a dpkg question
-mv_conffile() {
-  OLDCONFFILE="$1"
-  NEWCONFFILE="$2"
-
-  if [ -e "$OLDCONFFILE" ]; then
-    echo "Preserving user changes to $NEWCONFFILE ..."
-    mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
-    mv -f "$OLDCONFFILE" "$NEWCONFFILE"
-  fi
-}
-
-# update alternative, if it exists
-check_alternatives() {
-  BINNAME="$1"
-  BINPATH="$2"
-  MANSEC="$3"
-  if [ -e "$BINPATH"/"$BINNAME".procps ] ; then
-	update-alternatives --install "$BINPATH"/"$BINNAME" "$BINNAME" \
-	    "$BINPATH"/"$BINNAME".procps 50 \
-		--slave /usr/share/man/man"$MANSEC"/"$BINNAME"."$MANSEC".gz "$BINNAME"."$MANSEC".gz \
-		/usr/share/man/man"$MANSEC"/"$BINNAME".procps."$MANSEC".gz
-  fi
-}
-case "$1" in
-    configure|abort-remove|abort-deconfigure)
-		if [ -e /etc/psdevtab ] ; then
-			rm -f /etc/psdevtab
-		fi
-		if [ -e /etc/psdatabase ] 
-		then
-			rm -f /etc/psdatabase
-		fi
-       # Remove old procps init.d script, if it exists Closes: #55137
-       if [ -L /etc/rcS.d/S30procps.sh ]
-       then
-          update-rc.d -f procps.sh remove >/dev/null
-       fi
-       # and if that didn't work Closes: #92184 (#234306 with -L )
-       if [ -L /etc/rcS.d/S30procps.sh ]
-       then
-           rm -f /etc/rcS.d/S30procps.sh
-       fi
-	   # Remove moved procps.sh file, if it is there
-	   if dpkg --compare-versions "$2" le "1:3.2.7-3"; then
-		 mv_conffile "/etc/init.d/procps.sh" "/etc/init.d/procps"
-	   fi
-
-	   # Remove the old w alternative as procps is the only one
-	   if dpkg --compare-versions "$2" le "2:3.3.17-4"; then
-	       update-alternatives --remove w /usr/bin/w.procps
-	   fi
-
-		
-		# Do alternatives for uptime kill vmstat and ps, if required
-		check_alternatives "uptime" "/usr/bin" "1"
-		check_alternatives "kill" "/usr/bin" "1"
-		check_alternatives "vmstat" "/usr/bin" "8"
-		check_alternatives "ps" "/bin" "1"
-		
-    ;;
-
-    abort-upgrade)
-	    # Nothing to do
-    ;;
-
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
diff -Nru procps-4.0.6/debian/postrm procps-4.0.6/debian/postrm
--- procps-4.0.6/debian/postrm	2026-01-29 11:34:30.000000000 +0100
+++ procps-4.0.6/debian/postrm	1970-01-01 01:00:00.000000000 +0100
@@ -1,51 +0,0 @@
-#!/bin/sh
-# postrm script for procps
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <overwriter>
-#          <overwriter-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-restoreoldconffile()
-{
-  v=$1
-  f=/etc/init.d/procps
-  c=1:3.2.7-5
-  [ ! -e "$f" ] && return
-  dpkg --compare-versions "$1" ge "$c" || return
-  mv "$f" "$f.sh"
-}
-
-case "$1" in
-    abort-upgrade)
-	  restoreoldconffile
-	;;
-    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-    ;;
-
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
diff -Nru procps-4.0.6/debian/procps.postinst procps-4.0.6/debian/procps.postinst
--- procps-4.0.6/debian/procps.postinst	2026-01-29 11:34:30.000000000 +0100
+++ procps-4.0.6/debian/procps.postinst	2026-05-30 13:51:35.000000000 +0200
@@ -15,7 +15,7 @@
        && [ -d /proc/sys ] \
        && ! ischroot \
        && ! grep -qz '^container=' /proc/1/environ; then
-	echo 'procps: Applying updated sysctl configuration'
+        echo 'procps: Applying updated sysctl configuration'
         sysctl -q --system || true
     fi
 }
@@ -32,4 +32,27 @@
     exit 0
 fi
 
+# update alternative, if it exists
+check_alternatives() {
+    BINNAME="$1"
+    BINPATH="$2"
+    MANSEC="$3"
+    if [ -r "$BINPATH"/"$BINNAME".procps ] ; then
+        update-alternatives --install "$BINPATH"/"$BINNAME" "$BINNAME" \
+            "$BINPATH"/"$BINNAME".procps 50 \
+                --slave /usr/share/man/man"$MANSEC"/"$BINNAME"."$MANSEC".gz "$BINNAME"."$MANSEC".gz \
+                /usr/share/man/man"$MANSEC"/"$BINNAME".procps."$MANSEC".gz
+    fi
+}
+
+case "$1" in
+    configure|abort-remove|abort-deconfigure)
+        # Do alternatives for uptime vmstat w and ps, if required
+        check_alternatives "uptime" "/usr/bin" "1"
+        check_alternatives "vmstat" "/usr/bin" "8"
+        check_alternatives "w" "/usr/bin" "1"
+        check_alternatives "ps" "/bin" "1"        
+    ;;
+esac
+
 #DEBHELPER#
diff -Nru procps-4.0.6/debian/procps.prerm procps-4.0.6/debian/procps.prerm
--- procps-4.0.6/debian/procps.prerm	1970-01-01 01:00:00.000000000 +0100
+++ procps-4.0.6/debian/procps.prerm	2026-05-30 13:51:35.000000000 +0200
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# remove alternatives on package removal
+
+case "$1" in
+    remove)
+        [ -r /usr/bin/uptime.procps ] && update-alternatives --remove uptime /usr/bin/uptime.procps
+        [ -r /usr/bin/vmstat.procps ] && update-alternatives --remove vmstat /usr/bin/vmstat.procps
+        [ -r /usr/bin/w.procps ]      && update-alternatives --remove w      /usr/bin/w.procps
+        [ -r /usr/bin/ps.procps ]     && update-alternatives --remove ps     /bin/ps.procps
+        ;;
+esac
+
+#DEBHELPER#
diff -Nru procps-4.0.6/debian/rules procps-4.0.6/debian/rules
--- procps-4.0.6/debian/rules	2026-01-29 11:34:30.000000000 +0100
+++ procps-4.0.6/debian/rules	2026-05-30 13:24:54.000000000 +0200
@@ -26,6 +26,10 @@
 LINUX_CONFIGURE_EXTRA_FLAGS = --with-systemd --enable-libselinux
 endif
 
+ifeq ($(DEB_HOST_ARCH_OS), hurd)
+HURD_CONFIGURE_EXTRA_FLAGS = --disable-pidwait
+endif
+
 %:
 	dh $@
 
@@ -37,7 +41,7 @@
 	  --enable-watch8bit --enable-colorwatch \
 	  --enable-w-from \
 	  --enable-skill ${LINUX_CONFIGURE_EXTRA_FLAGS} \
-	  --disable-pidof \
+	  --disable-pidof ${HURD_CONFIGURE_EXTRA_FLAGS} \
 	  --disable-modern-top \
 	  --prefix=/usr \
 	  --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
@@ -50,20 +54,16 @@
 
 ifneq ($(DEB_HOST_ARCH_OS), linux)
 	rm -f \
-		$(DEBROOT)/bin/slabtop \
+		$(DEBROOT)/usr/bin/slabtop \
 		$(DEBROOT)/usr/share/man/man1/slabtop.1 \
-		$(DEBROOT)/sbin/sysctl \
+		$(DEBROOT)/usr/sbin/sysctl \
 		$(DEBROOT)/usr/share/man/man8/sysctl.8 \
 		$(DEBROOT)/usr/share/man/man5/sysctl.conf.5 \
 		$(NULL)
-
-    # Rename kill as there are two of them
-	(cd $(DEBROOT)/usr/bin && mv kill kill.procps )
-	(cd $(DEBROOT)/usr/share/man/man1 && mv kill.1 kill.procps.1 )
 endif
 ifeq ($(DEB_HOST_ARCH_OS), hurd)
 	rm -f \
-		$(DEBROOT)/bin/pmap \
+		$(DEBROOT)/usr/bin/pmap \
 		$(DEBROOT)/usr/share/man/man1/pmap.1 \
 		$(NULL)
 
@@ -71,6 +71,10 @@
 	(cd $(DEBROOT)/usr/bin && mv vmstat vmstat.procps )
 	(cd $(DEBROOT)/usr/share/man/man8 && mv vmstat.8 vmstat.procps.8 )
 
+	# Rename w as there are two of them
+	(cd $(DEBROOT)/usr/bin && mv w w.procps )
+	(cd $(DEBROOT)/usr/share/man/man1 && mv w.1 w.procps.1 )
+
 	# Rename uptime as there are two of them
 	(cd $(DEBROOT)/usr/bin && mv uptime uptime.procps )
 	(cd $(DEBROOT)/usr/share/man/man1 && mv uptime.1 uptime.procps.1 )

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to