[pkg-dhcp-devel] Bug#616290: Patches solving build failure for GNU/Hurd

Andrew Pollock apollock at debian.org
Tue May 31 04:11:34 UTC 2011


Hello,

Please find attached a patch that was submitted to fix failure to build on
GNU/Hurd.

The patch touches a bit, and applies cleanly to 4.2.1-P1 as well. I'd like
to get some sort of feedback on the validity of it and likelyhood of it
being applied upstream before I go applying it to the Debian version.

Please preserve the Cc list on this message so that our bug tracking system
is kept in the loop.

regards

Andrew

On Thu, Mar 03, 2011 at 09:42:10AM +0100, Svante Signell wrote:
> Package: isc-dhcp
> Version: 4.1.1-P1-16
> Severity: important
> Tags: patch, upstream
> User: debian-hurd at lists.debian.org
> Usertags: hurd
> 
> Attached are four patches to the isc-dhcp package to enable a successful
> build for GNU/Hurd. This patch has been developed together with Samuel
> Thibault, who improved my initial patches.
> 
> For a successful build from source, the one-line patch by Colin Watson
> in bug #602312, has to be applied to the  dhcp-4.1.0-ldap-code.dpatch in
> debian/patches. This is needed to cope with the new behavior of the
> linker: --no-add-needed since gcc-4.4.5-11
> http://wiki.debian.org/ToolChain/DSOLinking
> 
> The patches are:
> 
> 1) "patch" is a patch against the debian/ directory to update package
> dependencies and the patch order in 00list.
> 
> 2) "fix_ftbfs4hurd.dpatch", containing only upstream changes, to be
> added to debian/patches.
> 
> The following two files for debian/ are attached separately, to make
> them more readable for review:
> 
> 3) dhclient-script.hurd
> 4) dh-client-script.hurd.udeb
> 
> Thanks,
> Svante Signell





> _______________________________________________
> pkg-dhcp-devel mailing list
> pkg-dhcp-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-dhcp-devel

-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
# fix FTPFS for GNU/Hurd
@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' isc-dhcp-4.1.1-P1~/client/dhclient.c isc-dhcp-4.1.1-P1/client/dhclient.c
--- isc-dhcp-4.1.1-P1~/client/dhclient.c	2011-03-03 01:10:28.000000000 +0000
+++ isc-dhcp-4.1.1-P1/client/dhclient.c	2011-03-03 01:11:08.000000000 +0000
@@ -342,21 +342,33 @@
 	 * to be reopened after chdir() has been called
 	 */
 	if (path_dhclient_db[0] != '/') {
-		char *path = dmalloc(PATH_MAX, MDL);
+		char *path;
+#ifdef __GLIBC__
+		path = realpath(path_dhclient_db, NULL);
+#else
+		path = dmalloc(PATH_MAX, MDL);
 		if (path == NULL)
 			log_fatal("No memory for filename\n");
-		path_dhclient_db = realpath(path_dhclient_db, path);
-		if (path_dhclient_db == NULL)
-			log_fatal("%s: %s", path, strerror(errno));
+		path = realpath(path_dhclient_db, path);
+#endif
+		if (path == NULL)
+			log_fatal("%s: %s", path_dhclient_db, strerror(errno));
+		path_dhclient_db = path;
 	}
 
 	if (path_dhclient_script[0] != '/') {
-		char *path = dmalloc(PATH_MAX, MDL);
+		char *path;
+#ifdef __GLIBC__
+		path = realpath(path_dhclient_script, NULL);
+#else
+		path = dmalloc(PATH_MAX, MDL);
 		if (path == NULL)
 			log_fatal("No memory for filename\n");
-		path_dhclient_script = realpath(path_dhclient_script, path);
-		if (path_dhclient_script == NULL)
-			log_fatal("%s: %s", path, strerror(errno));
+		path = realpath(path_dhclient_script, path);
+#endif
+		if (path == NULL)
+			log_fatal("%s: %s", path_dhclient_script, strerror(errno));
+		path_dhclient_script = path;
 	}
 
 	/* first kill off any currently running client */
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' isc-dhcp-4.1.1-P1~/common/lpf.c isc-dhcp-4.1.1-P1/common/lpf.c
--- isc-dhcp-4.1.1-P1~/common/lpf.c	2011-03-03 01:06:44.000000000 +0000
+++ isc-dhcp-4.1.1-P1/common/lpf.c	2011-03-03 01:11:08.000000000 +0000
@@ -28,7 +28,6 @@
 
 #include "dhcpd.h"
 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
-#include <sys/ioctl.h>
 #include <sys/uio.h>
 #include <errno.h>
 
@@ -39,8 +38,14 @@
 #include "includes/netinet/ip.h"
 #include "includes/netinet/udp.h"
 #include "includes/netinet/if_ether.h"
+#endif
+
+#if defined (USE_LPF_RECEIVE) || defined (USE_LPF_HWADDR)
+#include <sys/ioctl.h>
 #include <net/if.h>
+#endif
 
+#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
 /* Reinitializes the specified interface after an address change.   This
    is not required for packet-filter APIs. */
 
@@ -411,7 +416,9 @@
 		interface_dereference (&fbi, MDL);
 	}
 }
+#endif
 
+#if defined (USE_LPF_RECEIVE) || defined (USE_LPF_HWADDR)
 void
 get_hw_addr(const char *name, struct hardware *hw) {
 	int sock;
@@ -442,18 +449,22 @@
 			memcpy(&hw->hbuf[1], sa->sa_data, 6);
 			break;
 		case ARPHRD_IEEE802:
+#ifndef __GNU__
 #ifdef ARPHRD_IEEE802_TR
 		case ARPHRD_IEEE802_TR:
 #endif /* ARPHRD_IEEE802_TR */
+#endif
 			hw->hlen = 7;
 			hw->hbuf[0] = HTYPE_IEEE802;
 			memcpy(&hw->hbuf[1], sa->sa_data, 6);
 			break;
+#ifndef __GNU__
 		case ARPHRD_FDDI:
 			hw->hlen = 17;
 			hw->hbuf[0] = HTYPE_FDDI;
 			memcpy(&hw->hbuf[1], sa->sa_data, 16);
 			break;
+#endif
 		default:
 			log_fatal("Unsupported device type %ld for \"%s\"",
 				  (long int)sa->sa_family, name);
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' isc-dhcp-4.1.1-P1~/configure.ac isc-dhcp-4.1.1-P1/configure.ac
--- isc-dhcp-4.1.1-P1~/configure.ac	2011-03-03 01:10:44.000000000 +0000
+++ isc-dhcp-4.1.1-P1/configure.ac	2011-03-03 01:11:36.000000000 +0000
@@ -366,9 +366,17 @@
 		AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
 		if test -n "$DO_BPF"
 		then
-			AC_DEFINE([HAVE_BPF], [""],
+			AC_DEFINE([HAVE_BPF], [1],
 	  			  [Define to 1 to use the 
 				   Berkeley Packet Filter interface code.])
+		else
+			AC_CHECK_HEADER(sys/socket.h, DO_SOCKET=1)
+			if test -n "$DO_SOCKET"
+			then
+				AC_DEFINE([HAVE_SOCKETS], [1],
+				[Define to 1 to use the
+				 standard BSD socket API.])
+			fi
 		fi
 	fi
 fi
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' isc-dhcp-4.1.1-P1~/includes/osdep.h isc-dhcp-4.1.1-P1/includes/osdep.h
--- isc-dhcp-4.1.1-P1~/includes/osdep.h	2011-03-03 01:06:44.000000000 +0000
+++ isc-dhcp-4.1.1-P1/includes/osdep.h	2011-03-03 01:13:23.000000000 +0000
@@ -90,6 +90,8 @@
 #  define USE_LPF 1
 # elif defined(HAVE_DLPI)
 #  define USE_DLPI 1
+# elif defined(HAVE_SOCKETS)
+#  define USE_SOCKETS 1
 # endif
 #endif
 
@@ -116,6 +118,8 @@
 #  define USE_SOCKET_RECEIVE
 #  if defined(HAVE_DLPI)
 #    define USE_DLPI_HWADDR
+#  else
+#    define USE_LPF_HWADDR
 #  endif
 #endif
 
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' isc-dhcp-4.1.1-P1~/server/dhcpd.c isc-dhcp-4.1.1-P1/server/dhcpd.c
--- isc-dhcp-4.1.1-P1~/server/dhcpd.c	2011-03-03 01:06:44.000000000 +0000
+++ isc-dhcp-4.1.1-P1/server/dhcpd.c	2011-03-03 01:11:08.000000000 +0000
@@ -449,12 +449,18 @@
          * to be reopened after chdir() has been called
          */
         if (path_dhcpd_db[0] != '/') {
-                char *path = dmalloc(PATH_MAX, MDL);
+                char *path;
+#ifdef __GLIBC__
+                path = realpath(path_dhcpd_db, NULL);
+#else
+                path = dmalloc(PATH_MAX, MDL);
                 if (path == NULL)
                         log_fatal("No memory for filename\n");
-                path_dhcpd_db = realpath(path_dhcpd_db,  path);
-                if (path_dhcpd_db == NULL)
-                        log_fatal("%s: %s", path, strerror(errno));
+                path = realpath(path_dhcpd_db, path);
+#endif
+                if (path == NULL)
+                        log_fatal("%s: %s", path_dhcpd_db, strerror(errno));
+                path_dhcpd_db = path;
         }
 
 	if (!quiet) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-dhcp-devel/attachments/20110530/550cee27/attachment-0001.pgp>


More information about the pkg-dhcp-devel mailing list