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

Bug#438952: kdelibs: FTBFS on hurd-i386



Package: kdelibs
Version: 4:3.5.7.dfsg.1-4
Severity: important
Tags: patch

Hi,

Kdelibs currently FTBFS because 

- on hurd-i386, the optional macro MAXPATHLEN is not defined since
there's no such hard global limit. readdir_r(), however, is known to be
limited to UCHAR_MAX on GNU/Hurd.
- on hurd-i386, the optional macro PATH_MAX is not defined either for
the same reason. The glibc version of getcwd(), however, can actually
allocate as much room as is required.

Here is a patch.

Samuel

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-xen
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

-- 
Samuel
> Allez, soyez sympa ... traduisez-lui "linux"
Linux, c'est comme le miel : c'est vachement bon mais ça attire les
mouches. En plus, ça colle aux doigts et on a du mal à s'en défaire.
-+- TP in: Guide du linuxien pervers - "Barrez vous les mouches !"
--- kdelibs-3.5.7.dfsg.1/kio/kio/kurlcompletion.cpp.orig	2007-08-21 01:20:27.125594000 +0200
+++ kdelibs-3.5.7.dfsg.1/kio/kio/kurlcompletion.cpp	2007-08-21 01:28:02.002981000 +0200
@@ -231,6 +231,9 @@
 		while ( !terminationRequested() &&
 		        (dirEntry = ::readdir( dir)))
 #else
+#if !defined(MAXPATHLEN) && defined(__GNU__)
+#define MAXPATHLEN UCHAR_MAX
+#endif
 		struct dirent *dirPosition = (struct dirent *) malloc( sizeof( struct dirent ) + MAXPATHLEN + 1 );
 		struct dirent *dirEntry = 0;
 		while ( !terminationRequested() &&
--- kdelibs-3.5.7.dfsg.1/kdoctools/meinproc.cpp.orig	2007-08-21 01:40:47.688059000 +0200
+++ kdelibs-3.5.7.dfsg.1/kdoctools/meinproc.cpp	2007-08-21 01:46:17.833610000 +0200
@@ -136,9 +136,18 @@
     }
 
     if ( args->isSet( "check" ) ) {
+#if !defined(PATH_MAX) && defined(__GLIBC__)
+        char *pwd_buffer;
+#else
         char pwd_buffer[PATH_MAX];
+#endif
         QFileInfo file( QFile::decodeName(args->arg( 0 )) );
-        if ( !getcwd( pwd_buffer, sizeof(pwd_buffer) - 1 ) ) {
+#if !defined(PATH_MAX) && defined(__GLIBC__)
+        if ( !(pwd_buffer = getcwd( NULL, 0 ) ) )
+#else
+        if ( !getcwd( pwd_buffer, sizeof(pwd_buffer) - 1 ) )
+#endif
+	{
 	     kdError() << "getcwd failed." << endl;
              return 2;
 	}
@@ -175,11 +184,18 @@
             }
             pclose( xmllint );
             chdir( pwd_buffer );
-            if ( !noout )
+            if ( !noout ) {
+#if !defined(PATH_MAX) && defined(__GLIBC__)
+                free( pwd_buffer );
+#endif
                 return 1;
+            }
         } else {
             kdWarning() << "couldn't find xmllint" << endl;
         }
+#if !defined(PATH_MAX) && defined(__GLIBC__)
+        free( pwd_buffer );
+#endif
     }
 
     xmlSubstituteEntitiesDefault(1);
--- kdelibs-3.5.7.dfsg.1/kioslave/file/file.cc.orig	2007-08-21 01:51:36.702504000 +0200
+++ kdelibs-3.5.7.dfsg.1/kioslave/file/file.cc	2007-08-21 01:55:39.362966000 +0200
@@ -1234,8 +1234,13 @@
        directories we keep as active directory. And
        as the slave runs in the background, it's hard
        to see for the user what the problem would be */
+#if !defined(PATH_MAX) && defined(__GLIBC__)
+    char *path_buffer;
+    path_buffer = getcwd(NULL, 0);
+#else
     char path_buffer[PATH_MAX];
     (void) getcwd(path_buffer, PATH_MAX - 1);
+#endif
     if ( chdir( _path.data() ) )  {
         if (errno == EACCES)
             error(ERR_ACCESS_DENIED, _path);
@@ -1261,6 +1266,9 @@
     kdDebug(7101) << "============= COMPLETED LIST ============" << endl;
 
     chdir(path_buffer);
+#if !defined(PATH_MAX) && defined(__GLIBC__)
+    free(path_buffer);
+#endif
 
     finished();
 }
--- kdelibs-3.5.7.dfsg.1/libkmid/fmout.cc.orig	2007-08-21 02:05:03.032474000 +0200
+++ kdelibs-3.5.7.dfsg.1/libkmid/fmout.cc	2007-08-21 02:08:08.281128000 +0200
@@ -127,8 +127,8 @@
 void FMOut::loadFMPatches(void)
 {
 #ifdef HAVE_OSS_SUPPORT
-  char patchesfile[PATH_MAX];
-  char drumsfile[PATH_MAX];
+  char patchesfile[strlen(FMPatchesDirectory)+7+1];
+  char drumsfile[strlen(FMPatchesDirectory)+9+1];
   int size;
   struct sbi_instrument instr;
   char tmp[60];
@@ -141,12 +141,12 @@
 
   if (opl==3)
   {
-    snprintf(patchesfile, PATH_MAX, "%s/std.o3",FMPatchesDirectory);
+    snprintf(patchesfile, sizeof(patchesfile), "%s/std.o3",FMPatchesDirectory);
     size=60;
   }
   else
   {
-    snprintf(patchesfile, PATH_MAX, "%s/std.sb",FMPatchesDirectory);
+    snprintf(patchesfile, sizeof(patchesfile), "%s/std.sb",FMPatchesDirectory);
     size=52;
   }
   fh=fopen(patchesfile,"rb");
@@ -171,11 +171,11 @@
 
   if (opl==3)
   {
-    snprintf(drumsfile, PATH_MAX, "%s/drums.o3",FMPatchesDirectory);
+    snprintf(drumsfile, sizeof(drumsfile), "%s/drums.o3",FMPatchesDirectory);
   }
   else
   {
-    snprintf(drumsfile, PATH_MAX, "%s/drums.sb",FMPatchesDirectory);
+    snprintf(drumsfile, sizeof(drumsfile), "%s/drums.sb",FMPatchesDirectory);
   }
 
   fh=fopen(drumsfile,"rb");
--- kdelibs-3.5.7.dfsg.1/kinit/lnusertemp.c.orig	2007-08-21 02:16:31.074726000 +0200
+++ kdelibs-3.5.7.dfsg.1/kinit/lnusertemp.c	2007-08-21 02:17:13.037686000 +0200
@@ -89,6 +89,9 @@
 }
 
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
 int build_link(const char *tmp_prefix, const char *kde_prefix)
 {
   struct passwd *pw_ent;

Reply to: