[torquedev] [Bug 141] New: PBSD_authenticate overwrites value of PBS_O_PATH

bugzilla-daemon at supercluster.org bugzilla-daemon at supercluster.org
Tue Jun 28 21:01:56 MDT 2011


http://www.clusterresources.com/bugzilla/show_bug.cgi?id=141

           Summary: PBSD_authenticate overwrites value of PBS_O_PATH
           Product: TORQUE
           Version: 2.5.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: libtorque
        AssignedTo: dbeer at adaptivecomputing.com
        ReportedBy: dmneal at waikato.ac.nz
                CC: torquedev at supercluster.org
   Estimated Hours: 0.0


Seen in versions 2.5.5 and 2.5.7.

PBSD_authenticate overwrites the value of PATH with only the first item of
PATH's value, that is the text to the left of the first colon.
PBSD_authenticate being invoked by qsub causes the PBS_O_PATH passed to jobs to
have the wrong value. When qsub is used with both "-c enabled" and "-V", the
job's value of PATH is set to the value of $PBS_O_PATH, which is unlikely to
allow the job to run correctly.

This looks to be fixable by applying to pbsD_connect.c something like

@@ -492,6 +492,7 @@
   int    j;
   FILE *piff;
   char  *ptr;
+  char *buffer, *temp_ptr;

   struct stat buf;

@@ -521,20 +522,25 @@

       if ((ptr = getenv("PATH")) != NULL)
         {
-        ptr = strtok(ptr, ":");
+    buffer = (char *)malloc(strlen(ptr)+1);
+    temp_ptr = buffer;
+        strcpy(temp_ptr, ptr);

-        while (ptr != NULL)
+        temp_ptr = strtok(temp_ptr, ":");
+
+        while (temp_ptr != NULL)
           {
           snprintf(iffpath, sizeof(iffpath), "%s/pbs_iff",
-                   ptr);
+                   temp_ptr);

           rc = stat(iffpath, &buf);

           if (rc != -1)
             break;

-          ptr = strtok(NULL, ":");
+          temp_ptr = strtok(NULL, ":");
           }  /* END while (ptr != NULL) */
+    free(buffer);
         }    /* END if ((ptr = getenv("PATH")) != NULL) */

       if (rc == -1)

Use of strtok_r instead of strtok may be a viable alternative.

-- 
Configure bugmail: http://www.clusterresources.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the torquedev mailing list