Bug#1142807: pgstat: FTBFS on hurd-amd64: getopt/optind undeclared
Federico Bonino <[email protected]> Sun, 26 Jul 2026 12:45:11 +0000
| Newsgroups | gmane.linux.debian.ports.hurd |
|---|---|
| Message-ID | <CAE6APk7yMtgpJ1+ENk=yMC=23rb6EU2Oz=udeHM4iCVKwExS0Q__32952.6117349573$1785070169$gmane$org@mail.gmail.com> |
--0000000000008248ce065782fd2d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Package: pgstat Version: 1.4.0-2 Severity: important Tags: patch, ftbfs User: [email protected] Usertags: hurd-amd64 X-Debbugs-Cc: [email protected] 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 =E2=80=98getopt= =E2=80=99 pgstat.c:776:7: error: =E2=80=98optind=E2=80=99 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/4cab84a976865614aa3d14306f97398f4028= 9f38 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 --- pgstat-unistd.patch --- Description: Include <unistd.h> for getopt on GNU/Hurd Origin: upstream, https://github.com/gleu/pgstats/commit/4cab84a976865614aa3d14306f97398f4028= 9f38 Applied-Upstream: commit:4cab84a976865614aa3d14306f97398f40289f38 Last-Update: 2026-07-26 --- 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 <[email protected]> --0000000000008248ce065782fd2d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Package: pgstat<br>Version: 1.4.0-2<br>Severity: impo= rtant<br>Tags: patch, ftbfs<br>User: <a href=3D"mailto:[email protected]= bian.org">[email protected]</a><br>Usertags: hurd-amd64<br>X-Deb= bugs-Cc: <a href=3D"mailto:[email protected]">debian-hurd@lists.= debian.org</a><br><br>pgstat fails to build from source on hurd-amd64 becau= se pgstat.c uses getopt() and optind without including the POSIX header tha= t declares them.<br><br>The relevant compiler errors are:<br><br>=C2=A0 pgs= tat.c:601:15: error: implicit declaration of function =E2=80=98getopt=E2=80= =99<br>=C2=A0 pgstat.c:776:7: error: =E2=80=98optind=E2=80=99 undeclared<br= ><br>pgstat.c only includes <sys/ioctl.h> before the PostgreSQL front= end headers. On GNU/Hurd the POSIX getopt/optind declarations are not trans= itively pulled in, so they are undeclared.<br><br>Upstream has already fixe= d this by including <unistd.h>:<br><br><a href=3D"https://github.com/= gleu/pgstats/commit/4cab84a976865614aa3d14306f97398f40289f38">https://githu= b.com/gleu/pgstats/commit/4cab84a976865614aa3d14306f97398f40289f38</a><br><= br>Please cherry-pick the pgstat.c part of that upstream commit. The minima= l backport is included below.<br><br>I verified the backport on native GNU/= Hurd amd64 running Debian sid:<br>dpkg-buildpackage exited 0, autopkgtest e= xited 0, and its pgstat test passed.<br><br>Toolchain stamp:<br>- gnumach 1= .8+git20260224-up-amd64<br>- hurd 1:0.9.git20260527-3+b1<br>- libc0.3 2.42-= 17<br>- binutils 2.46.90.20260712-1<br>- gcc 4:15.2.0-5+b1<br><br>--- pgsta= t-unistd.patch ---<br>Description: Include <unistd.h> for getopt on G= NU/Hurd<br>Origin: upstream, <a href=3D"https://github.com/gleu/pgstats/com= mit/4cab84a976865614aa3d14306f97398f40289f38">https://github.com/gleu/pgsta= ts/commit/4cab84a976865614aa3d14306f97398f40289f38</a><br>Applied-Upstream:= commit:4cab84a976865614aa3d14306f97398f40289f38<br>Last-Update: 2026-07-26= <br><br>--- a/pgstat.c<br>+++ b/pgstat.c<br>@@ -14,6 +14,7 @@<br>=C2=A0 * S= ystem headers<br>=C2=A0 */<br>=C2=A0#include <sys/ioctl.h><br>+#inclu= de <unistd.h><br>=C2=A0<br>=C2=A0<br>=C2=A0/*<br><br>Assisted-by: hur= d-collab agent (automated portability triage/fix)<br>Signed-off-by: Federic= o Bonino <<a href=3D"mailto:[email protected]">[email protected]= </a>></div></div> --0000000000008248ce065782fd2d--