Bug#522101: libao: FTBFS on hurd-i386

Samuel Thibault samuel.thibault at ens-lyon.org
Tue Mar 31 19:22:49 UTC 2009


Package: libao
Version: 0.8.8-5
Severity: important
Tags: patch

Hello,

libao currently FTBFS on hurd-i386 because of its unconditional use of
the static PATH_MAX limit, which hurd-i386 doesn't have as it may change
or even not exist.  Please see attached patch fixing it.

Samuel

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-- 
Samuel
 J'ai un gros problème: j'ai cet exercice à rendre demain lundi, mais ma
 TI 89 ne sait pas le faire...
 Est-ce que quelqu'un pourrait m'aider??
 -+- OD In Guide du Neuneu Usenet : Comment ça ! Il faut réfléchir ?-+-
-------------- next part --------------
--- ./src/audio_out.c.orig	2009-03-31 21:54:58.650000000 +0100
+++ ./src/audio_out.c	2009-03-31 21:57:00.040000000 +0100
@@ -253,7 +253,6 @@
 	struct dirent *plugin_dirent;
 	char *ext;
 	struct stat statbuf;
-	char fullpath[PATH_MAX];
 	DIR *plugindir;
 	driver_list *plugin;
 	driver_list *driver = end;
@@ -262,7 +261,8 @@
 	plugindir = opendir(AO_PLUGIN_PATH);
 	if (plugindir != NULL) {
 		while ((plugin_dirent = readdir(plugindir)) != NULL) {
-			snprintf(fullpath, PATH_MAX, "%s/%s", 
+			char fullpath[strlen(AO_PLUGIN_PATH) + 1 + strlen(plugin_dirent->d_name) + 1];
+			snprintf(fullpath, sizeof(fullpath), "%s/%s", 
 				 AO_PLUGIN_PATH, plugin_dirent->d_name);
 			if (!stat(fullpath, &statbuf) && 
 			    S_ISREG(statbuf.st_mode) && 
--- ./src/plugins/pulse/ao_pulse.c.orig	2009-03-31 21:58:00.050000000 +0100
+++ ./src/plugins/pulse/ao_pulse.c	2009-03-31 22:05:08.230000000 +0100
@@ -71,7 +71,7 @@
 }
 
 int ao_plugin_test(void) {
-    char p[PATH_MAX], t[256], t2[256];
+    char *p, t[256], t2[256];
     const char *fn;
     struct pa_simple *s;
     static const struct pa_sample_spec ss = {
@@ -79,17 +79,32 @@
         .rate = 44100,
         .channels = 2
     };
+    size_t allocated = 128;
 
     disable_sigpipe();
     
     if (getenv("PULSE_SERVER") || getenv("PULSE_SINK"))
         return 1;
 
-    if ((fn = pa_get_binary_name(p, sizeof(p)))) {
-        snprintf(t, sizeof(t), "libao[%s]", fn);
-        snprintf(t2, sizeof(t2), "libao[%s] test", fn);
-    }
+    while (1) {
+        p = pa_xmalloc(allocated);
+
+        if (!(fn = pa_get_binary_name(p, allocated))) {
+            pa_xfree(p);
+            break;
+        }
+
+        if (fn != p || strlen(p) < allocated - 1) {
+            snprintf(t, sizeof(t), "libao[%s]", fn);
+            snprintf(t2, sizeof(t2), "libao[%s] playback stream", fn);
+            break;
+        }
 
+        pa_xfree(p);
+        allocated *= 2;
+    }
+    pa_xfree(p);
+    
     if (!(s = pa_simple_new(NULL, fn ? t : "libao", PA_STREAM_PLAYBACK, NULL, fn ? t2 : "libao test", &ss, NULL, NULL, NULL)))
         return 0;
 
@@ -136,10 +151,11 @@
 }
 
 int ao_plugin_open(ao_device *device, ao_sample_format *format) {
-    char p[PATH_MAX], t[256], t2[256];
+    char *p, t[256], t2[256];
     const char *fn = NULL;
     ao_pulse_internal *internal;
     struct pa_sample_spec ss;
+    size_t allocated = 128;
 
     assert(device && device->internal && format);
 
@@ -160,11 +176,25 @@
 
     disable_sigpipe();
 
-    if (pa_get_binary_name(p, sizeof(p))) {
-        fn = pa_path_get_filename(p);
-        snprintf(t, sizeof(t), "libao[%s]", fn);
-        snprintf(t2, sizeof(t2), "libao[%s] playback stream", fn);
+    while (1) {
+        p = pa_xmalloc(allocated);
+
+        if (!(fn = pa_get_binary_name(p, allocated))) {
+            pa_xfree(p);
+            break;
+        }
+
+        if (fn != p || strlen(p) < allocated - 1) {
+            fn = pa_path_get_filename(fn);
+            snprintf(t, sizeof(t), "libao[%s]", fn);
+            snprintf(t2, sizeof(t2), "libao[%s] playback stream", fn);
+            break;
+        }
+
+        pa_xfree(p);
+        allocated *= 2;
     }
+    pa_xfree(p);
     
     if (!(internal->simple = pa_simple_new(internal->server, fn ? t : "libao", PA_STREAM_PLAYBACK, internal->sink, fn ? t2 : "libao playback stream", &ss, NULL, NULL, NULL)))
         return 0;


More information about the pkg-xiph-maint mailing list