Re: Bug#1142807: pgstat: FTBFS on hurd-amd64: getopt/optind undeclared
Samuel Thibault <[email protected]> Sun, 26 Jul 2026 14:53:10 +0200
| Newsgroups | gmane.linux.debian.ports.hurd |
|---|---|
| Organization | I am not organized |
| Message-ID | <amYDNo-2TqIiahgW@end> |
Hello, Thanks for this! This is really like we'd want it :) - make sure upstream is fixed - kindly ask for backport to debian (though it is really interesting for really-wanted packages, otherwise it may not be worth the effort both from your side and from the Debian maintainer side: the fix will land in Debian eventually anyway) Samuel Federico Bonino, le dim. 26 juil. 2026 12:45:11 +0000, a ecrit: > Package: pgstat > Version: 1.4.0-2 > Severity: important > Tags: patch, ftbfs > User: [1][email protected] > Usertags: hurd-amd64 > X-Debbugs-Cc: [2][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 ‘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>: > > [3]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 > > --- pgstat-unistd.patch --- > Description: Include <unistd.h> for getopt on GNU/Hurd > Origin: upstream, [4]https://github.com/gleu/pgstats/commit/ > 4cab84a976865614aa3d14306f97398f40289f38 > 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 <[5][email protected]> > > References: > > [1] mailto:[email protected] > [2] mailto:[email protected] > [3] https://github.com/gleu/pgstats/commit/4cab84a976865614aa3d14306f97398f40289f38 > [4] https://github.com/gleu/pgstats/commit/4cab84a976865614aa3d14306f97398f40289f38 > [5] mailto:[email protected]