Bugzilla – Bug 141
PBSD_authenticate overwrites value of PBS_O_PATH
Last modified: 2011-06-29 09:51:30 MDT
You need to log in before you can comment on or make changes to this bug.
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.
Patch was tested, slightly modified, verified, and checked in.