Hello,

I have reworked the patch a bit, extended it, tested it, and will NMU-0
it, here is the diff

Samuel
diff -urN pvm-3.4.5/debian/changelog pvm-3.4.5+nmu/debian/changelog
--- pvm-3.4.5/debian/changelog  2011-08-19 21:00:34.000000000 +0000
+++ pvm-3.4.5+nmu/debian/changelog      2011-08-19 21:50:38.000000000 +0000
@@ -1,3 +1,13 @@
+pvm (3.4.5-12.3) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Add patch 22-fix_FTBFS4hurd.patch (Closes: #622932). Thanks Svante Signell
+    for initial patch.
+  * Add patch 23-fix_trunc.patch to fix O_TRUNC undefined behavior without
+    O_WRONLY or O_RDWR.
+
+ -- Samuel Thibault <sthiba...@debian.org>  Fri, 19 Aug 2011 20:59:48 +0000
+
 pvm (3.4.5-12.2) unstable; urgency=low
 
   * Non-maintainer upload.
diff -urN pvm-3.4.5/debian/patches/22-fix_FTBFS4hurd.patch 
pvm-3.4.5+nmu/debian/patches/22-fix_FTBFS4hurd.patch
--- pvm-3.4.5/debian/patches/22-fix_FTBFS4hurd.patch    1970-01-01 
00:00:00.000000000 +0000
+++ pvm-3.4.5+nmu/debian/patches/22-fix_FTBFS4hurd.patch        2011-08-19 
21:22:46.000000000 +0000
@@ -0,0 +1,77 @@
+Index: pvm-3.4.5+nmu/src/pvmd.c
+===================================================================
+--- pvm-3.4.5+nmu.orig/src/pvmd.c      2011-08-19 21:06:13.000000000 +0000
++++ pvm-3.4.5+nmu/src/pvmd.c   2011-08-19 21:22:43.000000000 +0000
+@@ -3836,7 +3836,8 @@
+       int pid;                                /* task pid */
+       int pfd[2];                             /* pipe back from task */
+       struct task *tp;                /* new task context */
+-      char path[MAXPATHLEN];
++      char *path = NULL, *new_path;
++      size_t path_size = 0, needed_size;
+       struct stat sb;
+       char **ep, **eplist;
+       int i;
+@@ -3868,6 +3869,24 @@
+       eplist = CINDEX(name, '/') ? nullep : epaths;
+ 
+       for (ep = eplist; *ep; ep++) {
++              needed_size = strlen(*ep) + 1;
++              if ((*ep)[0])
++                      needed_size++;
++              needed_size += strlen(name);
++#ifdef IMA_OS2
++              needed_size += 4;
++#endif
++              if (path_size < needed_size) {
++                      path_size += needed_size;
++                      new_path = realloc(path, path_size);
++                      if (!new_path) {
++                              pvmlogerror("cannot allocate memory\n");
++                              free(path);
++                              task_free(tp);
++                              return PvmOutOfRes;
++                      }
++                      path = new_path;
++              }
+               (void)strcpy(path, *ep);
+               if (path[0])
+                       (void)strcat(path, "/");
+@@ -3939,12 +3958,14 @@
+                       if (socketpair(AF_UNIX, SOCK_STREAM, 0, pfd) == -1) {
+                               pvmlogperror("forkexec() socketpair");
+                               task_free(tp);
++                              free (path);
+                               return PvmOutOfRes;
+                       }
+ #else
+                       if (pipe(pfd) == -1) {
+                               pvmlogperror("forkexec() pipe");
+                               task_free(tp);
++                              free (path);
+                               return PvmOutOfRes;
+                       }
+ #endif
+@@ -4077,6 +4098,7 @@
+                               (void)close(pfd[0]);
+                               (void)close(pfd[1]);
+                               task_free(tp);
++                              free (path);
+                               return PvmOutOfRes;
+                       }
+                       (void)close(pfd[1]);
+@@ -4094,12 +4116,14 @@
+ 
+               tp->t_a_out = STRALLOC(name);
+               *tpp = tp;
++              free (path);
+               return 0;
+       }
+       if (pvmdebmask & PDMTASK) {
+               pvmlogprintf("forkexec() didn't find <%s>\n", name);
+       }
+       task_free(tp);
++      free (path);
+       return PvmNoFile;
+ }
+ 
diff -urN pvm-3.4.5/debian/patches/23-fix_trunc.patch 
pvm-3.4.5+nmu/debian/patches/23-fix_trunc.patch
--- pvm-3.4.5/debian/patches/23-fix_trunc.patch 1970-01-01 00:00:00.000000000 
+0000
+++ pvm-3.4.5+nmu/debian/patches/23-fix_trunc.patch     2011-08-19 
21:49:40.000000000 +0000
@@ -0,0 +1,56 @@
+Index: pvm-3.4.5+nmu/misc/group-hack-337
+===================================================================
+--- pvm-3.4.5+nmu.orig/misc/group-hack-337     2011-08-19 21:47:23.000000000 
+0000
++++ pvm-3.4.5+nmu/misc/group-hack-337  2011-08-19 21:48:29.000000000 +0000
+@@ -165,7 +165,7 @@
+       tp->t_authnam = TALLOC(LEN_OF_TMP_NAM, char, "auth");
+       (void)TMPNAMFUN(tp->t_authnam);
+   
+-!     if ((tp->t_authfd = open(tp->t_authnam, O_RDONLY|O_CREAT|O_TRUNC, 0600))
++!     if ((tp->t_authfd = open(tp->t_authnam, O_RDWR|O_CREAT|O_TRUNC, 0600))
+ !     == -1) {
+               pvmlogperror("tm_connect() can't create d-auth file");
+               PVM_FREE(tp->t_authnam);
+@@ -178,7 +178,7 @@
+       tp->t_authnam = TALLOC(LEN_OF_TMP_NAM, char, "auth");
+       (void)TMPNAMFUN(tp->t_authnam);
+   
+-!     if ((tp->t_authfd = open(tp->t_authnam, O_RDONLY|O_CREAT|O_TRUNC, 
0600)) == -1) {
++!     if ((tp->t_authfd = open(tp->t_authnam, O_RDWR|O_CREAT|O_TRUNC, 0600)) 
== -1) {
+               pvmlogperror("tm_connect() can't create d-auth file");
+               PVM_FREE(tp->t_authnam);
+               tp->t_authnam = 0;
+Index: pvm-3.4.5+nmu/src/lpvm.c
+===================================================================
+--- pvm-3.4.5+nmu.orig/src/lpvm.c      2011-08-19 21:47:23.000000000 +0000
++++ pvm-3.4.5+nmu/src/lpvm.c   2011-08-19 21:49:16.000000000 +0000
+@@ -3089,11 +3089,7 @@
+ #ifndef IMA_MPP
+ #ifndef NOPROT
+       (void)PVMTMPNAMFUN(authfn);
+-#ifdef IMA_OS2
+       if ((authfd = open(authfn, O_RDWR|O_CREAT|O_TRUNC, 0600)) == -1) {
+-#else
+-      if ((authfd = open(authfn, O_RDONLY|O_CREAT|O_TRUNC, 0600)) == -1) {
+-#endif
+               pvmlogperror(authfn);
+               pvmlogerror("pvmbeatask() can't creat t-auth file\n");
+               cc = PvmSysErr;
+Index: pvm-3.4.5+nmu/src/tdpro.c
+===================================================================
+--- pvm-3.4.5+nmu.orig/src/tdpro.c     2011-08-19 21:47:23.000000000 +0000
++++ pvm-3.4.5+nmu/src/tdpro.c  2011-08-19 21:48:52.000000000 +0000
+@@ -570,12 +570,7 @@
+       tp->t_authnam = TALLOC(PVMTMPNAMLEN, char, "auth");
+       (void)PVMTMPNAMFUN(tp->t_authnam);
+ 
+-#ifndef IMA_OS2
+-      if ((tp->t_authfd = open(tp->t_authnam, O_RDONLY|O_CREAT|O_TRUNC, 0600))
+-#else
+-      if ((tp->t_authfd = open(tp->t_authnam, O_RDWR|O_CREAT|O_TRUNC, 0600))
+-#endif
+-      == -1) {
++      if ((tp->t_authfd = open(tp->t_authnam, O_RDWR|O_CREAT|O_TRUNC, 0600)) 
== -1) {
+               pvmlogperror("tm_connect() can't create d-auth file");
+               PVM_FREE(tp->t_authnam);
+               tp->t_authnam = 0;
diff -urN pvm-3.4.5/debian/patches/series pvm-3.4.5+nmu/debian/patches/series
--- pvm-3.4.5/debian/patches/series     2011-08-19 21:00:34.000000000 +0000
+++ pvm-3.4.5+nmu/debian/patches/series 2011-08-19 21:46:39.000000000 +0000
@@ -20,3 +20,5 @@
 99-old-build-system-changes-i-have-no-idea-what-are-for.patch
 20-fix-kfreebsd-ftbfs.patch
 21-sh4-support.patch
+22-fix_FTBFS4hurd.patch
+23-fix_trunc.patch

Reply via email to