[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#281870: marked as done (FTBFS on Hurd)



Your message dated Sun, 23 Jul 2006 11:52:10 +0200
with message-id <20060723095210.GA20550@localhost.localdomain>
and subject line Close
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: tla
Version: 1.2-4
Severity: wishlist
Tags: patch

Please apply the following patch to allow building on Hurd.

Thanks

diff -Nur tla-1.2_orig/debian/changelog tla-1.2/debian/changelog
--- tla-1.2_orig/debian/changelog	2004-11-16 02:35:24.000000000 +0100
+++ tla-1.2/debian/changelog	2004-11-18 09:56:12.000000000 +0100
@@ -1,6 +1,6 @@
-tla (1.2-4.0.1) unstable; urgency=low
+tla (1.2-4.1) unstable; urgency=low
 
-  * Built on Hurd.
+  * Patched to build on Hurd.
 
  -- Marc Dequènes (Duck) <Duck@DuckCorp.org>  Tue, 16 Nov 2004 02:35:23 +0100
 
diff -Nur tla-1.2_orig/src/hackerlab/piw/log.c tla-1.2/src/hackerlab/piw/log.c
--- tla-1.2_orig/src/hackerlab/piw/log.c	2003-12-06 20:31:56.000000000 +0100
+++ tla-1.2/src/hackerlab/piw/log.c	2004-11-18 00:17:58.000000000 +0100
@@ -267,24 +267,27 @@
   static char prog_dir[] = PROGDIR;
   static char build_dir[] = BUILDDIR;
   static char prog_glob[] = "piw-glob";
-  char prog[PATH_MAX + 1];
+  char *prog;
   
   log_fd = -2;	 		/* disable logging in the child process */
   close (pipe_fd[0]);
-  if (PATH_MAX < str_length (prog_dir) + 1 + str_length (prog_glob))
+  prog = (char*)malloc(str_length (prog_dir) + 1 + str_length (prog_glob) + 1);
+  if (prog == (char*)NULL)
     panic ("path to piw-glob too long");
   str_cpy (prog, prog_dir);
   str_cat (prog, "/");
   str_cat (prog, prog_glob);
   execve (prog, argv, environ);
   
-  if (PATH_MAX < str_length (build_dir) + 1 + str_length (prog_glob))
+  prog = (char*)realloc(prog, str_length (build_dir) + 1 + str_length (prog_glob) + 1);
+  if (prog == (char*)NULL)
     panic ("path to piw-glob too long");
   str_cpy (prog, build_dir);
   str_cat (prog, "/");
   str_cat (prog, prog_glob);
   execve (prog, argv, environ);
   panic ("unable to exec piw-glob");
+  free(prog);
 }
 
 
@@ -369,15 +372,20 @@
 	child = fork ();
 	if (child == 0)
 	  {
-	    char fd_name[PATH_MAX + 1];
-	    char fd_url[PATH_MAX + 1];
+            /* unsigned long are max 429496729 => 10 chars */
+	    char fd_name[10 + 1];
+	    char fd_url_prefix[] = "fd:";
+	    char *fd_url;
 	    char * argv[64];
 	    int argc;
 
 	    argc = 0;
 	    argv[argc++] = "piw-glob";
 	    argv[argc++] = "-o";
-	    str_cpy (fd_url, "fd:");
+	    fd_url = (char*)malloc(strlen(fd_url_prefix) + 10 + 1);
+	    if (fd_url == (char*=NULL))
+	      panic ("not enought memory");
+            str_cpy (fd_url, fd_url_prefix);
 	    cvt_long_to_decimal (fd_name, pipe_fd[1]);
 	    str_cat (fd_url, fd_name);
 	    argv[argc++] = fd_url;
@@ -385,6 +393,7 @@
 	    argv[argc++] = host;
 	    argv[argc++] = 0;
 	    piw_run_piw_glob (pipe_fd, argv);
+	    free(prog);
 	  }
 	else
 	  {
@@ -415,7 +424,11 @@
       struct sockaddr_un addr;
       int pipe_fd[2];
       int child;
-      t_uchar expanded_path[PATH_MAX + 1];
+      /* no way to evaluate the needed size because of vu_read_retry, choosing
+       * an arbitrary length (like PATH_MAX is)
+       */
+      int expanded_path_length = 256;
+      t_uchar expanded_path[expanded_path_length + 1];
       int errn;
 
       path = name + sizeof ("unix:") - 1;
@@ -431,15 +444,20 @@
       child = fork ();
       if (child == 0)
 	{
-	  char fd_name[PATH_MAX + 1];
-	  char fd_url[PATH_MAX + 1];
+          /* unsigned long are max 429496729 => 10 chars */
+	  char fd_name[10 + 1];
+	  char *fd_url;
+	  char fd_url_prefix[] = "fd:";
 	  char * argv[64];
 	  int argc;
 
 	  argc = 0;
 	  argv[argc++] = "piw-glob";
 	  argv[argc++] = "-o";
-	  str_cpy (fd_url, "fd:");
+	  fd_url = (char*)malloc(strlen(fd_url_prefix) + 10 + 1);
+	  if (fd_url == (char*=NULL))
+	    panic ("not enought memory");
+	  str_cpy (fd_url, fd_url_prefix);
 	  cvt_long_to_decimal (fd_name, pipe_fd[1]);
 	  str_cat (fd_url, fd_name);
 	  argv[argc++] = fd_url;
@@ -454,7 +472,7 @@
 	  int status;
 
 	  close (pipe_fd[1]);
-	  len = vu_read_retry (&errn, pipe_fd[0], expanded_path, PATH_MAX + 1);
+	  len = vu_read_retry (&errn, pipe_fd[0], expanded_path, expanded_path_length + 1);
 	  if (len < 0)
 	    panic ("error reading expanded pathname for $PIWLOG");
 	  /* expanded_path[len] is '\n' */
diff -Nur tla-1.2_orig/src/hackerlab/vu-network/url-socket.c tla-1.2/src/hackerlab/vu-network/url-socket.c
--- tla-1.2_orig/src/hackerlab/vu-network/url-socket.c	2004-01-09 21:52:55.000000000 +0100
+++ tla-1.2/src/hackerlab/vu-network/url-socket.c	2004-11-18 02:17:27.000000000 +0100
@@ -25,6 +25,9 @@
 #include "hackerlab/vu/vu-bad-arg.h"
 #include "hackerlab/vu-network/url-socket.h"
 
+/* A wrapper for gethostname that automatically checks system limitations. */
+char * xgethostname (void);
+

 /************************************************************************
  *(h0 "A VU Handler for the URL Socket Scheme")
@@ -1403,7 +1406,7 @@
   int fd;
   struct url_socket_params params;
   struct sockaddr_in addr;
-  t_uchar myhost[MAXHOSTNAMELEN + 1];
+  t_uchar *myhost;
 
   mem_set0 ((t_uchar *)&addr, sizeof (addr));
 
@@ -1414,12 +1417,14 @@
     {
       if (host_id_is)
 	{
-	  if (0 > gethostname (myhost, sizeof (myhost)))
+	  myhost = xgethostname();
+	  if (myhost == (t_uchar*)NULL)
 	    {
 	      *errn = errno;
 	      return -1;
 	    }
 	  *host_id_is = str_save (limits, myhost);
+	  free(myhost);
 	}
       addr.sin_addr.s_addr = htonl (INADDR_ANY);
     }
@@ -1479,10 +1484,11 @@
 	    }
 	  else
 	    {
-	      char my_name[MAXHOSTNAMELEN + 1];
+	      char *my_name;
 	      struct hostent * hostent;
 	  
-	      if (0 > gethostname (my_name, sizeof (my_name)))
+	      my_name = xgethostname();
+	      if (my_name == (char*)NULL)
 		{
 		  int ign;
 		  *errn = errno;
@@ -1491,6 +1497,7 @@
 		}
 
 	      hostent = gethostbyname (my_name);
+	      free(my_name);
 	      if (!hostent)
 		{
 		  int ign;
@@ -2017,3 +2024,108 @@
 
 static struct vu_fs_discipline url_server_socket_vtable = { VU_FS_DISCIPLINE_INITIALIZERS (url_server_socket_) };
 
+
+
+/* Copyright (c) 2001 Neal H Walfield <neal@cs.uml.edu>.
+   
+   This function is placed into the public domain.  Its distribution
+   is unlimited.
+
+   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+   IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
+   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+   IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* NAME
+
+	xgethostname - get the host name.
+
+   SYNOPSIS
+
+   	char *xgethostname (void);
+
+   DESCRIPTION
+
+	The xhostname function is intended to replace gethostname(2), a
+	function used to access the host name.  The old interface is
+	inflexable given that it assumes the existance of the
+	MAXHOSTNAMELEN macro, which neither POSIX nor the proposed
+	Single Unix Specification version 3 guarantee to be defined.
+
+   RETURN VALUE
+
+	On success, a malloced, null terminated (possibly truncated)
+	string containing the host name is returned.  On failure,
+	NULL is returned and errno is set.
+ */
+
+#include <sys/param.h>	/* For MAXHOSTNAMELEN */
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+
+char *
+xgethostname (void)
+{
+  int size = 0;
+  int addnull = 0;
+  char *buf;
+  int err;
+
+#ifdef MAXHOSTNAMELEN
+  size = MAXHOSTNAMELEN;
+  addnull = 1;
+#else /* MAXHOSTNAMELEN */
+#ifdef _SC_HOST_NAME_MAX
+  size = sysconf (_SC_HOST_NAME_MAX);
+  addnull = 1;
+#endif /* _SC_HOST_NAME_MAX */
+  if (size <= 0)
+    size = 256;
+#endif /* MAXHOSTNAMELEN */
+
+  buf = malloc (size + addnull);
+  if (! buf)
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  err = gethostname (buf, size);
+  while (err == -1 && errno == ENAMETOOLONG)
+    {
+      free (buf);
+
+      size *= 2;
+      buf = malloc (size + addnull);
+      if (! buf)
+	{
+	  errno = ENOMEM;
+	  return NULL;
+	}
+      
+      err = gethostname (buf, size);
+    }
+
+  if (err)
+    {
+      if (buf)
+        free (buf);
+      errno = err;
+      return NULL;
+    }
+
+  if (addnull)
+    buf[size] = '\0';
+
+  return buf;
+}
+
-- 
Marc Dequènes (Duck)

Attachment: pgpL49HWRRo2Z.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---

--- End Message ---

Reply to: