Package: hal
Version: 0.5.13-3
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

Hal currently FTBFS on GNU/Hurd because of unconditional PATH_MAX usage.
Also, it has Linux-only dependencies for the hal binary, and a small problem
in the initd script that prevents the hald startup via init.

The attached patch fixes all the above issues:
- tools/hal-disable-polling.c: fixed usage of realpath()+PATH_PATH into a
  growing buffer loop
- debian/control: disabled Linux-only depdendencies for hurd-i386, just like
  it was done for kfreebsd-*
- debian/hal.init: Hurd's proc translator does not provide /proc/$PID/root
  files, so the check erroneously fails and the scripts exits

Thanks,
-- 
Pino
--- hal-0.5.13.orig/tools/hal-disable-polling.c
+++ hal-0.5.13/tools/hal-disable-polling.c
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <errno.h>
 #include <glib.h>
 #include <libhal.h>
 
@@ -182,9 +183,15 @@
 
                 devices = libhal_manager_find_device_string_match (hal_ctx, "block.device", device, &num_devices, NULL);
 		if (devices == NULL || devices[0] == NULL) {
-			char real_device[PATH_MAX];
+                        char *real_device = NULL;
+                        size_t real_device_length = 32;
 
-			if (realpath(device, real_device) == NULL) {
+                        do {
+                                real_device_length *= 2;
+                                real_device = realloc (real_device, real_device_length);
+                        } while ((realpath (device, real_device) == NULL) && (errno == ENAMETOOLONG));
+
+                        if (real_device == NULL) {
                                 fprintf (stderr, "Cannot find device %s.\n", device);
                                 return 1;
                         }
@@ -194,10 +201,13 @@
 
                         if (devices == NULL) {
                                 fprintf (stderr, "Cannot find symlinked device %s -> %s.\n", device, real_device);
+                                free (real_device);
                                 return 1;
                         }
 
                         fprintf (stderr, "Following symlink from %s to %s.\n", device, real_device);
+
+                        free (real_device);
                 }
 
                 for (n = 0; devices[n] != NULL; n++) {
--- hal-0.5.13.orig/debian/control
+++ hal-0.5.13/debian/control
@@ -36,18 +36,18 @@
 Depends: ${shlibs:Depends}, ${misc:Depends},
  adduser,
  pciutils,
- usbutils,
- udev (>= 0.125) [!kfreebsd-amd64 !kfreebsd-i386],
+ usbutils [!hurd-i386],
+ udev (>= 0.125) [!kfreebsd-amd64 !kfreebsd-i386 !hurd-i386],
  dbus (>= 0.61),
  lsb-base (>= 3.2-14),
  hal-info (>= 20070402),
- mount (>= 2.13) [!kfreebsd-amd64 !kfreebsd-i386],
+ mount (>= 2.13) [!kfreebsd-amd64 !kfreebsd-i386 !hurd-i386],
  freebsd-utils [kfreebsd-amd64 kfreebsd-i386],
  policykit (>= 0.7),
  consolekit (>= 0.3),
  acl
 Recommends: eject,
- pm-utils [!kfreebsd-amd64 !kfreebsd-i386]
+ pm-utils [!kfreebsd-amd64 !kfreebsd-i386 !hurd-i386]
 Suggests: gnome-device-manager
 Description: Hardware Abstraction Layer
  HAL provides an abstract view on hardware.
--- hal-0.5.13.orig/debian/hal.init
+++ hal-0.5.13/debian/hal.init
@@ -61,7 +61,7 @@
 		exit 0
 	fi
 	
-	if [ "$(stat -c %d/%i /)" != "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
+	if [ "$(stat -c %d/%i /)" != "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ] && [ `uname` != "GNU" ]; then
 		log_failure_msg "Can't start $DESC - detected chrooted session"
 		exit 0
 	fi

Reply via email to