pgstat fails to build from source on hurd-amd64 because pgstat.c uses getopt() and optind without including the POSIX header that declares them. The relevant compiler errors are: pgstat.c:601:15: error: implicit declaration of function ‘getopt’ pgstat.c:776:7: error: ‘optind’ undeclared pgstat.c only includes <sys/ioctl.h> before the PostgreSQL frontend headers. On GNU/Hurd the POSIX getopt/optind declarations are not transitively pulled in, so they are undeclared. Upstream has already fixed this by including <unistd.h>: https://github.com/gleu/pgstats/commit/4cab84a976865614aa3d14306f97398f40289f38 Please cherry-pick the pgstat.c part of that upstream commit. The minimal backport is included below. I verified the backport on native GNU/Hurd amd64 running Debian sid: dpkg-buildpackage exited 0, autopkgtest exited 0, and its pgstat test passed. Toolchain stamp: - gnumach 1.8+git20260224-up-amd64 - hurd 1:0.9.git20260527-3+b1 - libc0.3 2.42-17 - binutils 2.46.90.20260712-1 - gcc 4:15.2.0-5+b1--- a/pgstat.c +++ b/pgstat.c @@ -14,6 +14,7 @@ * System headers */ #include <sys/ioctl.h> +#include <unistd.h> /* Assisted-by: hurd-collab agent (automated portability triage/fix) Signed-off-by: Federico Bonino <buzondefede@gmail.com>
Hello, Bug #1142807 in pgstat reported by you has been fixed in the Git repository and is awaiting an upload. You can see the commit message below and you can check the diff of the fix at: https://salsa.debian.org/postgresql/pgstat/-/commit/692735647cae20a0159c006be74d24a88ac8624c (this message was generated automatically) -- Greetings https://bugs.debian.org/1142807
Hi, Thanks, I've uplaoded your patch. Michael
We believe that the bug you reported is fixed in the latest version of pgstat, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to 1142807@bugs.debian.org, and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Michael Banck <mbanck@debian.org> (supplier of updated pgstat package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org) Format: 1.8 Date: Sun, 26 Jul 2026 17:26:50 +0200 Source: pgstat Architecture: source Version: 1.4.0-3 Distribution: unstable Urgency: medium Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Changed-By: Michael Banck <mbanck@debian.org> Closes: 1142807 Changes: pgstat (1.4.0-3) unstable; urgency=medium . * Team upload. * Include FTBFS fix for hurd-amd64, by Federico Bonino. (Closes: #1142807) Checksums-Sha1: f0239ade1e84003b856f4bdfcabf78757b52a3f5 1993 pgstat_1.4.0-3.dsc 2584b01508cb4979b66c5d985c7717a541432796 3356 pgstat_1.4.0-3.debian.tar.xz d9bc633511346d486443a5f9629ff5c875a5e9a6 7830 pgstat_1.4.0-3_source.buildinfo Checksums-Sha256: 85caa11473a70aedf4d68b909f3452b0a162635ed052cf02aebb08057c3fd901 1993 pgstat_1.4.0-3.dsc c96d13887f6bc8bc06bb16bec2e285783468dcf6577ddf7104d00a83c1a1eb78 3356 pgstat_1.4.0-3.debian.tar.xz b4b18d6282612e06a7aba710de22c000973d20a11dd4b6cb0718145e28edbd57 7830 pgstat_1.4.0-3_source.buildinfo Files: 44e066c00dffb5380faa3947abbbb79d 1993 database optional pgstat_1.4.0-3.dsc 72ec23e0b0d712759df9288965c7318b 3356 database optional pgstat_1.4.0-3.debian.tar.xz 950af764c5f5a5ed7ef6927f4b1263b7 7830 database optional pgstat_1.4.0-3_source.buildinfo -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEnKh3dJ+rLk+paGLs3GhqJ7Q0gbAFAmpmKAYACgkQ3GhqJ7Q0 gbCwuQ//WMcIdxctK6wlmecVr+HoFoCP044LhUjalxDSfUEHnymiaYrT2LXXbtAd izBDA1Ss9t3xOl7KZJOeuFcQzWCS+IAkZSTlBvNIZpcYmpzAE/v42J42g/J5C392 G2pxwtJBsmaJCpJxyzQ0kZYd59q7woE9STOzECsn6+NtTIvLTxH+ZeZB4pca018H rIFUyOnQqJ/0XbTOqbJBwYsaLSxKZWX0neWHAIXbTe6ORXQK/UAhCGPhJ5Q7BD7O N6RLd92HZJewUhzaguE3tpMpuOa2rYBhtLYIOqfVVDfk0eJ5pY848X9GzJL7GeJZ I7bJgBY2nLVUEIfu4fZUD+98tMFiJ00CrvYHinDTxk0GWST6AxL12/ki2YCZLLpt 4yCJoOEVE0ven5xtJhTdBI5qa8kK60fK1twJUPYUTdLn89Vnvz+RFekwG64mEoXs q5+Um2NMHb/EiNZZybdhXZNHZ3QBOjp59V160cnMt5XGp98uyn8Lz56SO0ILQ8uQ cpKiEpZO4d18qUyqHjLBZ7Nq09qj3ZDrwL2kYjW/qxVR9xY+jlwYQ0sQoq3pv9FX 65PDBB7ZtXRZvylvkk4USoLBMQ7GRLfs+mXAZLuV4fT7NJiapcRYpl5f1gh4g8BR xAAxCHsB4W8rda8pANGcpfDNWCWT7nhN+x89wXDV7XipZePJd00= =Dz8i -----END PGP SIGNATURE-----