tag 879963 + patch
thanks

In data venerdì 27 ottobre 2017 21:44:01 CET, Bernd Zeimetz ha scritto:
> > Builds of gpsd 3.17 for hurd-i386 and kfreebsd-* (admittedly not
> > release architectures) have been failing:
> > 
> >   os_compat.c: In function 'int os_daemon(int, int)':
> >   os_compat.c:124:12: error: 'daemon' was not declared in this scope
> >        return daemon(nochdir, noclose);
> > 
> > Please #include <unistd.h> here for all Debian architectures, not just
> > Linux.
> 
> which cpp define matches kfreebsd properly? freebsd doesn't need unistd.h.

Indeed FreeBSD just needs stdlib.h [1], while the glibc implementation
needs unistd.h [2].  An option here could be to remove the OS check,
and include both (they are POSIX).

In addition to that, there are few more issues, and attached there are
patches for them, grouped by issues:

* glibc.diff: this fixes the issue mentioned so far, by using unistd.h
  for any glibc-based platform

* man.diff: since ntpshmmon is built only on Linux (as pps-tools is
  specific for Linux), then it makes sense to restrict the installation
  of its man page only when the executable is built; hence, copy the
  same checks used to built the executable

* debian.diff: ntpshmmon and ppscheck are Linux-only, so use dh-exec to
  restrict them for linux-any architectures; *important* detail:
  debian/gpsd-clients.install and debian/gpsd.install must be executable
  (i.e. chmod +x them) for this to work (see the dh compat v9)

All the non-Debian patches can be upstreamed as well.

[1] 
https://www.freebsd.org/cgi/man.cgi?query=daemon&sektion=3&manpath=FreeBSD+11.1-RELEASE+and+Ports
[2] https://linux.die.net/man/3/daemon

Thanks,
-- 
Pino Toscano
--- a/os_compat.c
+++ b/os_compat.c
@@ -106,7 +106,7 @@ int os_daemon(int nochdir, int noclose)
 
 #else /* HAVE_DAEMON */
 
-#ifdef __linux__
+#if defined (__linux__) || defined (__GLIBC__)
 
 /* daemon() needs _DEFAULT_SOURCE */
 #undef _DEFAULT_SOURCE
--- a/SConstruct
+++ b/SConstruct
@@ -1592,9 +1592,13 @@ base_manpages = {
     "gps2udp.1": "gps2udp.xml",
     "gpsdecode.1": "gpsdecode.xml",
     "srec.5": "srec.xml",
-    "ntpshmmon.1": "ntpshmmon.xml",
 }
 
+if env['pps'] and (env["timeservice"] or env["gpsdclients"]):
+    base_manpages.update({
+        "ntpshmmon.1": "ntpshmmon.xml",
+    })
+
 if tiocmiwait:
     base_manpages.update({
         "ppscheck.8": "ppscheck.xml",
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,8 @@ Build-Depends: debhelper (>= 8.1.3~), po
  scons (>= 2.0.1), chrpath,
  dh-buildinfo,
  pps-tools (>= 0.20120406+g0deb9c7e-2~) [linux-any],
- dh-systemd (>= 1.3)
+ dh-systemd (>= 1.3),
+ dh-exec,
 Standards-Version: 3.9.2
 Homepage: http://www.catb.org/gpsd/
 Vcs-Browser: http://git.recluse.de/?p=debian/pkg-gpsd.git
--- a/debian/control.in
+++ b/debian/control.in
@@ -16,7 +16,8 @@ Build-Depends: debhelper (>= 8.1.3~), po
  scons (>= 2.0.1), chrpath,
  dh-buildinfo,
  pps-tools (>= 0.20120406+g0deb9c7e-2~) [linux-any],
- dh-systemd (>= 1.3)
+ dh-systemd (>= 1.3),
+ dh-exec,
 Standards-Version: 3.9.2
 Homepage: http://www.catb.org/gpsd/
 Vcs-Browser: http://git.recluse.de/?p=debian/pkg-gpsd.git
--- a/debian/gpsd-clients.install
+++ b/debian/gpsd-clients.install
@@ -1,3 +1,4 @@
+#!/usr/bin/dh-exec
 usr/bin/gpsctl
 usr/bin/gpspipe
 usr/bin/gpsmon
@@ -21,5 +22,5 @@ usr/share/man/man1/xgps.1
 usr/share/man/man1/xgpsspeed.1
 usr/share/man/man1/gpxlogger.1
 usr/share/man/man1/gps2udp.1
-usr/bin/ntpshmmon
-usr/share/man/man1/ntpshmmon.1
+[linux-any] usr/bin/ntpshmmon
+[linux-any] usr/share/man/man1/ntpshmmon.1
--- a/debian/gpsd.install
+++ b/debian/gpsd.install
@@ -1,4 +1,5 @@
+#!/usr/bin/dh-exec
 usr/sbin/*
 usr/share/man/man8/*
 lib/systemd/system/*
-usr/bin/ppscheck
+[linux-any] usr/bin/ppscheck

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

Reply via email to