Source: gworkspace
Version: 0.9.2-1
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

Currently gworkspace FTBFS on GNU/Hurd due to usage of PATH_MAX, which
is not defined. It did build previously, latest Hurd version is
0.8.8-1.2+b1. The attached patch solves this by allocating the newpath
string in GWMetadata/gmds/gmds/gmds.m and
GWMetadata/gmds/mdextractor/mdextractor.m dynamically.

Thanks!



Index: gworkspace-0.9.2/GWMetadata/gmds/gmds/gmds.m
===================================================================
--- gworkspace-0.9.2.orig/GWMetadata/gmds/gmds/gmds.m
+++ gworkspace-0.9.2/GWMetadata/gmds/gmds/gmds.m
@@ -94,12 +94,13 @@ static void path_moved(sqlite3_context *
   int newblen = strlen((const char *)newbase);
   const unsigned char *oldpath = sqlite3_value_text(argv[2]);
   int oldplen = strlen((const char *)oldpath);
-  char newpath[PATH_MAX] = "";
+  char *newpath = NULL;
   int i = newblen;
   int j;
   
-  strncpy(newpath, (const char *)newbase, newblen);  
-  
+  newpath = malloc(newblen) + 1;
+  strncpy(newpath, (const char *)newbase, newblen + 1);
+
   for (j = oldblen; j < oldplen; j++) {
     newpath[i] = oldpath[j];
     i++;
Index: gworkspace-0.9.2/GWMetadata/gmds/mdextractor/mdextractor.m
===================================================================
--- gworkspace-0.9.2.orig/GWMetadata/gmds/mdextractor/mdextractor.m
+++ gworkspace-0.9.2/GWMetadata/gmds/mdextractor/mdextractor.m
@@ -87,12 +87,13 @@ static void path_moved(sqlite3_context *
   int newblen = strlen((const char *)newbase);
   const unsigned char *oldpath = sqlite3_value_text(argv[2]);
   int oldplen = strlen((const char *)oldpath);
-  char newpath[PATH_MAX] = "";
+  char *newpath = NULL;
   int i = newblen;
   int j;
-  
-  strncpy(newpath, (const char *)newbase, newblen);  
-  
+
+  newpath = malloc(newblen) + 1;
+  strncpy(newpath, (const char *)newbase, newblen + 1);
+
   for (j = oldblen; j < oldplen; j++) {
     newpath[i] = oldpath[j];
     i++;

Reply via email to